flexible lighting

i want my app to be able to render with a variable number of lights, and up to the maximum number allowed by a particular implementation. but how can i set or unset lights using glLight* calls if the light number (eg LIGHT0 etc) has to be hardcoded into the code, whilst at the same time i don’t know at compile time how many lights will be available?

Barny,

The OpenGL specs states that:

GL_LIGHT1=GL_LIGHT0+1
GL_LIGHT2=GL_LIGHT0+2

GL_LIGHTn=GL_LIGHT0+n

And GL_LIGHT0 is the same for all OpenGL implementation.

It should solve your problem !

Regards.

Eric