Sharing a GLContext

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Sharing a GLContext

kitfox
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?