Only one light lit


i’m using the following code to install eight lights (left, right, top …):

for ( int i = 0; i < 8; i++){
glLightfv(GL_LIGHT0 + i, GL_AMBIENT, LightAmbient);
glLightf(GL_LIGHT0 + i, GL_SPOT_CUTOFF, 7.f);
glLightfv(GL_LIGHT0 + i, GL_POSITION, LightPosition[i]);

problem is that only light 0 functions correct. the other lights seem to shine with low intensity so that the scene is hardly lighten. the normals for the polygon are allright (from nehe) and even if i give every light the same position nothing changes. what might be the problem.
can anyone help me?

bye stephan

have you enabled all the lights?

Originally posted by chowe6685:
have you enabled all the lights?

Yeah, i enabled every light.

By default, all lights are black except GL_LIGHT0 which is white. I think your other lights are still black, cause you don’t set any diffuse or specular color (assuming that piece of code is all you do to the lights), so they default to RGBA=(0,0,0,1).

I experimented a little bit more and found a solution. I set the ambientLight to {1,1,1,1} but more important was to change

glMaterialfv( GL_FRONT, GL_DIFFUSE , materialDiffuse );


glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE , materialDiffuse );

everything fine now