Reply – Re: Current threading model
Your Name
or Cancel
In Reply To
Re: Current threading model
— by gouessej gouessej

The OpenGL calls must be done when the OpenGL context is current, that's all, it was already true at the very beginning of JOGL and it's still true nowadays. When you use GLEventListener and Animator, the OpenGL calls are done on the AWT event dispatching thread if and only if you use a canvas or a window relying on AWT, it's a bit different on NEWT.

It has been possible to perform OpenGL calls on other threads than the EDT for many years as long as the OpenGL context is current by making it current on those other threads, you can put those calls into GLRunnable instances and send them to the queue, see GLAutoDrawable.invoke(boolean, GLRunnable).

However, making the context current on another thread than the one on which the window has been created might be unsupported by some drivers.

Moreover, I don't see a huge benefit in a threading model, you cannot make the OpenGL context current on several threads at the same time. If you really expect something big from multi-threading in this case, there is probably something wrong in your code. A clean separation between what requires a current OpenGL context and what doesn't require it helps to perform only the necessary things when the OpenGL context is current and to perform the rest on multiple threads if possible.

What do you expect?
Julien Gouesse | Personal blog | Website