Hi there,
This is not a question but a warning of a trap, and probably a request for a jogl feature. Those who can cite the OpenGL specification from memory probably won’t find this very entertaining, but still, I found it worth mentioning after investing two hours into debugging
I recently enabled lighting operations in my jogl-based engine and observed some weird behavior, with lit faces flickering between almost correct result color and ambient base color randomly.
I had initialized my light’s position like this …
a_gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, new float[]{10f,10f,10f});
… assuming that a 3-vector would be required. Of course, this is wrong, light position is set in homogenous coordinates, the correct call being …
a_gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, new float[]{10f,10f,10f,1f});
Now the problem is that jogl did tell me exactly nothing about this. I mean, one would exepect some range checking and an error message, or at least a crash, but jogl silently accepts the too-short array and obviously sets the missing parameter … to 0, which is fatal if you are working with homogenous coordinates, if a default value then it should be 1, which would allow people to pass 3-Vectors and get valid results.
So newbies (like me ) don’t fall for it, and jogl-team, if you find the time, think of something.
Cheers
Wolfgang