honny
01-10-2003, 12:51 AM
i have some trouble with normals.
i have an application drawing lot of quads, for each quads i needs its normal.
so for each quad i have a loop that sounds like this :
glBegin(GL_QUADS);
glNormal3f(n0,n1,n2);
glVertex3f(i,random,j);
glVertex3f(i+1,random,j);
glVertex3f(i+1,random,j+1);
glVertex3f(i,random,j+1);
glEnd();
it is not exactly like this but it is the meaning .
the problem is that the values of normal is always 0.
what is wrong ?
talking of math i know that a normal for a surface is :
(v0-v1) x (v1-v2)
where v0,v1,v2 are 3 vertices of the surfaces.
in my case they are 3 vertices of my quad.
i have an application drawing lot of quads, for each quads i needs its normal.
so for each quad i have a loop that sounds like this :
glBegin(GL_QUADS);
glNormal3f(n0,n1,n2);
glVertex3f(i,random,j);
glVertex3f(i+1,random,j);
glVertex3f(i+1,random,j+1);
glVertex3f(i,random,j+1);
glEnd();
it is not exactly like this but it is the meaning .
the problem is that the values of normal is always 0.
what is wrong ?
talking of math i know that a normal for a surface is :
(v0-v1) x (v1-v2)
where v0,v1,v2 are 3 vertices of the surfaces.
in my case they are 3 vertices of my quad.