Enable/Disable Lighting or Light0?

When enabling/disabling lighting with one light, is it proper to enable/disable GL_Light0 as well as GL_Lighting, or instead of? When you leave lighting enabled and light0 disabled, is there an unnecessary performance cost for parts of the scene that don’t need lighting (bitmaps, flat shapes, etc)?

Thanks!

Lighting, means tell gl to use lighting calculations in the render pipline.

LIGHT0, is a definition of a light implementation. i.e. type of light, position, color, attenuation etc. etc…

GL allows for 8 lights, GL_LIGHT0, to GL_LIGHT7.

To use 1 light, you can use any one of these. They need enabling also for their values to be used.

need to do this IIRC

glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);

//setup light 0.

Nutty

Nutty, I think he wanted to know what is better to do if he doesnt need lighting to render something, to disable his lights, or to disable all lighting…

DOH! That’ll teach me to answer questions on the piss!

Probably disable GL_LIGHTING.

Thats what I would do anyway.

Nutty (pissed as a fart)

zed (sober unfortunately)
not being a driver writer
ild say this is better

glDisable(GL_LIGHTING)

than glDisable(GL_LIGHT0)
i have a feeling with this way if lighting is enabled the driver will have to check what lights are enabled

I agree that disabling GL_LIGHTING would be the way to go. If you were to just disabled GL_LIGHT0, you would disable all lights, but lighting would still be performed so everything would be dark! You’d then have to rely on the ambient lighting properties if you wanted to even see anything.