Login  Register

Re: Obtaining OpenGL Context Handle without Passing as a Variable.

Posted by jmaasing on Apr 02, 2014; 4:32am
URL: https://forum.jogamp.org/Obtaining-OpenGL-Context-Handle-without-Passing-as-a-Variable-tp4032092p4032093.html

I hope some of the more experienced devs can correct me if I'm wrong.
Depending on circumstances (for example using windowed mode, NEWT/AWT and so on) the GLContext might change between frames. So it is a lot better to get it from JOGL each frame and pass it around rather than hanging on to it in some global variable.

Personally I think global or Thread local variables are a poor design, you should never hide resource usage, but tastes are different :-)