Exhibit A:
net.java.games.jogl.GLException: Error freeing OpenGL context
at net.java.games.jogl.impl.windows.WindowsGLContext.free(WindowsGLContext.java:129)
at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.free(WindowsOnscreenGLContext.java:129)
at net.java.games.jogl.impl.GLContext.invokeGL(GLContext.java:194)
at net.java.games.jogl.GLCanvas.display(GLCanvas.java:75)
at net.java.games.jogl.Animator$1.run(Animator.java:87)
at java.lang.Thread.run(Thread.java:536)
Not a very pretty error message, and one that had me very confused for quite a while. Even more odd because the only code i changed was pretty much removed from being able to cause this kind of errors.
Eventually, after much cursing, i tracked it down to a glColor4f call, which when commented out worked fine, yet adding it threw the above error on sporadic occasions.
So, have a look at this:
Colour4f col = null;
gl.glColor4f(colour.red, colour.green, colour.blue, colour.alpha);
This was what was happening by accident, yet instead of throwing a NullPointerException which would have pointed me in the correct direction, i get the earlier mentioned exception. I can only assume that i have stepped into a whopping great big try…catch by using the Animator class, which is mistakenly catching my null pointer, and rethrowing it as something mutated and wrong >:(
Can anyone give a more complete explanation? Better yet, is it possible to get this behaviour changed?
Thanks.