Login  Register

Re: Hello! and Error: ...incorrectly used with a different GLContext...

Posted by gouessej on Aug 12, 2016; 5:04pm
URL: https://forum.jogamp.org/Hello-and-Error-incorrectly-used-with-a-different-GLContext-tp4036820p4037057.html

Yes it makes sense. I have repeated numerous times that the GL instances can become invalid at any time. Therefore, a developer should never store them in any field or in global variables, (s)he should only store them into local variables with a limited scope and avoid passing them, (s)he should get it from a drawable or with GLContext.getCurrentGL(). If you look at the source code of the numerous renderers I have maintained for years, you'll see that I strictly follow these guidelines. Storing a GL instance into a (probably never updated) static variable is an excellent example of what shouldn't be done. Thank you for your feedback, it illustrates my advices.

Edit.: By the way, my latest advice in my previous post was correct. I just feel sad that you didn't understand it and I hope that now you see the importance of providing a SSCCE.
Julien Gouesse | Personal blog | Website