PDA

View Full Version : Enable/Disable Lighting or Light0?



jpmorgan
06-14-2001, 06:34 AM
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!

Nutty
06-14-2001, 11:23 AM
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

Anonymous Coward
06-14-2001, 11:46 AM
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...

Nutty
06-14-2001, 12:50 PM
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
06-14-2001, 05:02 PM
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

Deiussum
06-15-2001, 04:54 AM
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.