dvwood
01-12-2009, 07:50 AM
I am in big doubt of calculating the normal...
Lets say i want to calculate the normal for the following quad with those exact values. I mean, do i have to take 2 of the points, subtract them from each other, to get a vector, then do the same with other points, and then take the cross-product of these two vectors, and then normalize - of course all done on paper, cause it doesnt make any sense computing all of that (i dont even know how to implement that). I know that OpenGL does this for you, but how can i make OpenGL do it for me with this example?
glBegin(GL_QUADS);
glVertex3f(-200.0f, 110.3f, -100.0f);
glVertex3f(-100.0f, 110.3f, 100.0f);
glVertex3f(100.0f, 110.3f, 100.0f);
glVertex3f(200.0f, 110.3f, -100.0f);
glNormal3f( ?, ?, ?);
In OpenGL there is no such thing as a face normal, therefore i have to calculate the normal for each vertex, not that it matters cause i am still kind of lost....
any thoughts?
Lets say i want to calculate the normal for the following quad with those exact values. I mean, do i have to take 2 of the points, subtract them from each other, to get a vector, then do the same with other points, and then take the cross-product of these two vectors, and then normalize - of course all done on paper, cause it doesnt make any sense computing all of that (i dont even know how to implement that). I know that OpenGL does this for you, but how can i make OpenGL do it for me with this example?
glBegin(GL_QUADS);
glVertex3f(-200.0f, 110.3f, -100.0f);
glVertex3f(-100.0f, 110.3f, 100.0f);
glVertex3f(100.0f, 110.3f, 100.0f);
glVertex3f(200.0f, 110.3f, -100.0f);
glNormal3f( ?, ?, ?);
In OpenGL there is no such thing as a face normal, therefore i have to calculate the normal for each vertex, not that it matters cause i am still kind of lost....
any thoughts?