PDA

View Full Version : lights, normals, glDrawElements



gemelli_d
02-25-2003, 06:08 AM
hi.
I have a (maybe) strange problem.
I have lights (with attenuation). I'm rendering my geometry with glDrawElements. I have a normal array, vertex array, ... I checked my normals, everything is ok.
when I render using this:
glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer(GL_FLOAT,0,p_Np);
the shading is ok but my lights looks like if they were moved a bit from where I put them.
if I replace the first line with glDisableClientState(GL_NORMAL_ARRAY), the shading is "flat" (of course, there is no normal) but the light is centered at the right place.
I'm not sure about the clarity of this...I have screenshots but nowhere to put them.
thanks for any info you can provide.

SThomas
02-25-2003, 06:00 PM
if you want to email me your screenshots i'll put them up. my email's in the profile. also, posting the relevant code would be helpful.

gemelli_d
02-25-2003, 11:46 PM
thanks, I did it.
here are a few lines that might be related to my "problem".

glDisable(GL_CULL_FACE);
glShadeModel(GL_SMOOTH);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_FALSE);

glEnableClientState(GL_VERTEX_ARRAY);

glEnableClientState(GL_NORMAL_ARRAY);
// glDisableClientState(GL_NORMAL_ARRAY);

glVertexPointer(3,GL_FLOAT,0,p_Vp);
glNormalPointer(GL_FLOAT,0,p_Np);

glDrawElements(GL_TRIANGLES, nb * 3, GL_UNSIGNED_INT, &p_Ip[oldJ * 3]);

thanks. I'll do more tests today.

gemelli_d
02-26-2003, 01:56 AM
OH NO !
that was my fault...my $#*%@ export plugin was wrong...
sorry for the inconvenience...