Login  Register

Sharing a GLContext

Posted by kitfox on Mar 23, 2012; 6:49pm
URL: https://forum.jogamp.org/Sharing-a-GLContext-tp3852465.html

I have a GLJPanel which I'm using to render a scene.  I would like to call some GL methods outside of the GLEventListener callbacks.  

I am currently doing this by calling GLJPanel.getContext() and then GLContext.makeCurrent().  I then call GLJPanel.getGL(), call my GL methods and finish by calling GLContext.release().

This is currently working for me - however, I"m worried that I may run into issues, particularly if the GL thread and the Swing threads overlap in their calls to GLContext.makeCurrent() and GLContext.release().  Is there a safer way to share the GL context with a second thread?