PDA

View Full Version : OpenGL lights don't attenuate!



147-2
07-08-2003, 01:47 PM
I am using


glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, !inf());
if(inf())
{
glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 1);
glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0);
glLightf(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0);
}
else
{
glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0);
glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0);
glLightf(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 1);
}

to set my light's attenuation. The function inf() returns whether or not the light is an infinite light. The funny thing is, the lights don't attenuate at all (they're constant attenuation). Is there something I might be missing here?

Thaellin
07-08-2003, 02:23 PM
Is the 'w' coordinate for your light non-zero? Directional lights do not attenuate.

Other than that, I think I'd need to see a code sample and/or screenshot.

Good Luck,
-- Jeff

roffe
07-08-2003, 02:25 PM
Originally posted by 147-2:
(they're constant attenuation).

The distance between the light and models/vertices aren't close to 1 is it?