GL_MAX_LIGHTS < 8 ?

Howdy all,

just a small issue with JOGL:

  1. The code
// find the number of possible lights
ByteBuffer bb = ByteBuffer.allocateDirect( 4 );
bb.order( ByteOrder.LITTLE_ENDIAN );
IntBuffer ib = bb.asIntBuffer();
drawable.getGL().glGetIntegerv( GL.GL_MAX_LIGHTS, ib );
ib.position( 0 );
System.out.println( "Max lights = " + ib.get() );

Always prints out “Max lights = 0”, while the OpenGL specs say that it should be at least 8. What’s going on there?
I don’t really need more than the standard 8, but I’m kind of:
a) Interested in how many i could have
b) Worried that this kind of thing isn’t restricted to GL_MAX_LIGHTS. Are there any other non-operative glGet*()s?

Hi,

Be sure to make your :
drawable.getGL().glGetIntegerv( GL.GL_MAX_LIGHTS, ib );
call in the good thread (the simplest is to try in one of the GLEventListener method).
It’ll certainly return you a correct number of lights!

I added your code into my init() and I’m getting 8.

Doh!

That’s got it now. Ta muchly.

I just ran this test and it returned a value of 16 for MAX_LIGHTS, but there are only defined constants up to GL_LIGHT7 showing up in my code completion window. Are there 16? If so, how do I reference them without the constants?

Using this formula GL_LIGHTn = GL_LIGHT0 + n

Vincent

Thanks much. I suppose I was stuck on the idea that if the JOGL guys hadn’t put the constants in there was some sort of inconsistency with my results.