Re: Exclusive Context Thread
Posted by
gouessej on
Apr 24, 2015; 9:27am
URL: https://forum.jogamp.org/Exclusive-Context-Thread-tp4034366p4034367.html
Hi
Actually, numerous drivers don't behave correctly especially under Windows when you drive the OpenGL context current on another thread that the one on which the window was created, especially with Intel drivers.
In my humble opinion, you should avoid useless context switches. I didn't do it carefully in JogAmp's Ardor3D Continuation and I got a huge boost (frame rate 12 times bigger) when I fixed it. It's possible to drive the context current at the beginning of the rendering and release it at the end of the rendering, it is typically done before and after calling GLEventListener.display() but if you don't need to make it current on several threads (even though you use GLAutoDrawable.invoke()), you just need to make it current once and release it only when you destroy your drawable. Note that as stated in the doc, it's particularly suitable when using NEWT. GLContext is just an abstraction. Look at the unit tests and use setExclusiveContextThread only if you use an animator and if you don't call GLContext.makeCurrent().