I have made up a simple Cube with using GL_TRIANGLE_STRIP and set one light.
The first Quad(first 4 vertices) are lit correctly, but the next quads(defined by 2 vertices each) are not. Only the right side is lit, cause the new normal vector is only applied to the 2 new vertices. How can i fix this problem?

Here is a short piece of code:

``````glBegin(GL_QUAD_STRIP);
glNormal3fv(normalize_vec(torso[0], torso[1], torso[2]).vec_array);
glVertex3fv(torso[0].vec_array);
glVertex3fv(torso[1].vec_array);
glVertex3fv(torso[3].vec_array);
glVertex3fv(torso[2].vec_array);
glNormal3fv(normalize_vec(torso[3], torso[4], torso[5]).vec_array);
glVertex3fv(torso[5].vec_array);
glVertex3fv(torso[4].vec_array);
glNormal3fv(normalize_vec(torso[5], torso[6], torso[7]).vec_array);
glVertex3fv(torso[7].vec_array);
glVertex3fv(torso[6].vec_array);
glNormal3fv(normalize_vec(torso[7], torso[8], torso[9]).vec_array);
glVertex3fv(torso[9].vec_array);
glVertex3fv(torso[8].vec_array);
glEnd();``````

Hi !

The order of the vertices is odd for quad strips. after the first two vertices it goes like this:

2n-1, 2n, 2n+2, and 2n+1, notice the order 2n+2 and 2n+1 the last two are reversed.

I think this is your problem, you have to reorder the vertices a bit.

Mikael

To order of the vertices I usesd is correct I think( or better hope!? ).
I have found a few other examples in the net, but there’s the problem, i put the important lines of code into my files and there’s the same problem, the first quad is lit correctly, the others not -> only the right side of the quads are lit(if I move the light straigt along the axis).
Here is more code(forgot it to post, last time):

``````nv_scalar lightPos[]	 = {   0.0f,  6.0f,  0.0f, 1.0f};
nv_scalar spotDir[]		 = {   0.0f, -1.0f,  0.0f};
nv_scalar ambientLight[] = {   0.3f,   0.3f,   0.3f, 1.0f};
nv_scalar diffuseLight[] = {   0.7f,   0.7f,   0.7f, 1.0f};
nv_scalar specularLight[]     = {   1.0f,   1.0f,   1.0f, 1.0f};

vec3 torso[] = {		vec3(-1.5f,  -1.5f,  1.5f),
vec3(-1.5f,   1.5f,  1.5f),
vec3( 1.5f,   1.5f,  1.5f),
vec3( 1.5f,  -1.5f,  1.5f),
vec3( 1.5,    1.5f, -1.5f),
vec3( 1.5,   -1.5f, -1.5f),
vec3(-1.5f,   1.5f, -1.5f),
vec3(-1.5f,  -1.5f, -1.5f),
vec3(-1.5f,   1.5f,  1.5f),
vec3(-1.5f,  -1.5f,  1.5f) };

glFrontFace(GL_CW);
glLightfv(GL_LIGHT0, GL_POSITION, lightPos);
glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, spotDir);
glLightfv(GL_LIGHT0, GL_AMBIENT,  ambientLight);
glLightfv(GL_LIGHT0, GL_DIFFUSE,  diffuseLight);
glLightfv(GL_LIGHT0, GL_SPECULAR, specularLight);``````