Hi, I would like to know if you could help me with a problem that I have with glNormal and GL_TRIANGLE_STRIP.
I'm making a terrain. To do that, I use triangles strip. All works fine, but now, I would like to give values of normals to openGL.
I've already calculated my normals and the probleme isn't there.
I'm doing this :
for (int z=0; z<length-1; z++)
{
glBegin(GL_TRIANGLE_STRIP);
for (int x=0; x<width-1; x++)
{
glTexCoord2f(x, z);
glVertex3f(x, heightMap[x][z], z);
glTexCoord2f(x, z+1);
glVertex3f(x, heightMap[x][z+1], z+1);
}
glEnd();
}
When I execute this code, it generates a heightmap. But, I would like to know where to place the call for glNormal3f().
I know to do that if I use GL_TRIANGLES. I have to place it before the 3 glVertex call, but there, it's different.
Have you an idea about how to do that ?
I've posted this message in the GameDev OpenGL forum and A guy told me to do a call to glNormal3f() before each glVertex()...
I'm okay to do this but, ...
5 6
*---*
|\ |
| \ |
| \|
|3 |4
*---*
|\ |
| \ |
| \|
| |
*---*
1 2
(sorry, it's not very nice
)
my code is making point1, point2, point3, point4 ...
My normals are stored in an array. So, do you think I have to call glNormal3f() before my point1 with the value of the normal of face(1,2,3) and then glNormal3f() before my point2 with the value of the normal of face(2,3,4), etc ... ?
Sorry for my very bad english. I hope that you can understand it
Edited by - bestel on February 5, 2002 1:02:05 PM