PDA

View Full Version : How to loop though all OpenGL lights ?



blender
03-08-2001, 02:22 AM
How can I loop through all the lights that I have defined ?

I need something like this:
for (light = 0, light <= max_light, light++)
switch_on(light);

The Problem is that OpenGL uses the enum const GL_LIGHT0, GL_LIGHT1 and so on. And I can not rely on that GL_LIGHT1 = GL_LIGHT0 + 1

Bob
03-08-2001, 02:57 AM
The specifications says thay GL_LIGHTn is identical to GL_LIGHT0 + n. So you can do like that to loop through all lights.

blender
03-08-2001, 03:53 AM
Hey that's great. That will make it quite comfortable. Thank you for clarifying this.