I have an object on which I want to apply lighting. It is described in a text file with its vertex coordinates.
I read the following in OpenGL Superbible:
void m3dFindNormal(M3DVector3f vNormal, const M3DVector3f vP1, const M3DVector3f vP2, const M3DVector3f vP3);
To use this function, pass it a vector to store the normal and three vectors (each only an array of three floats) from your polygon or triangle (indicated in the counterclockwise winding order). Note that this returned a normal vector, not necessarily a unit length (Normalized).
I understand that the order in which I pass the vertices (clockwise or counterclockwise) determines the orientation of the normal vector, so I'm wondering how to get the function to work with the file in this format .
source
share