Light attenuation

For some reason, light attenuation does not want to work in a game I’m writing

When I light the scene with
glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 2.5);
glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 5.0);
(http://www.frontiernet.net/~mcameron/light1.jpg)
I see no difference from when I use
glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 1.0);
glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.0);
(http://www.frontiernet.net/~mcameron/light2.jpg)
The light is a point light (located between the two characters) and only uses ambient and diffuse. I’ve tried moving its position about 500 m away from the characters, and there is still no hint of diminishing intensity.

Any ideas?

Hi,

Your light should be positional instead of directional one. Like this:

GLFloat lightpos[] = {1.0, 1.0, 1.0, 1.0);
glLightfv(GL_LIGHT0, GL_POSITION, lightpos);

The last item in lightpos vector determines whether the light is positional (1) or directional (0). No attenuation is calculated for directional lights

/n