PDA

View Full Version : what kind of gl command manipulate face normals



XMaterial
01-20-2011, 06:45 PM
is there any command manipulate face normals,i assume glNormal*() but i ve no idea how to use it.

ugluk
01-20-2011, 09:17 PM
You can transform them with a matrix or something more exotic in the vertex shader, or you can do it on the CPU and then specify them with glNormal*(). If you use the fixed pipeline in most cases the GL will handle the transformation for you.

_arts_
01-21-2011, 03:35 AM
Just use glNormal before calling to glVertex, and change it for every faces.

dalemac
01-21-2011, 11:26 AM
Or if your using vertex arrays, you can enable the normal array and set the pointer to your array before drawing.

for example:



glEnableClientState(GL_NORMAL_ARRAY); //enable the normal array
glNormalPointer(GL_FLOAT, 0, myNormals); //set the normal array to the array holding your normal data

glDrawElements(GL_QUADS, 4, GL_UNSIGNED_BYTE, myIndices); //draw the object
glDisableClientState(GL_NORMAL_ARRAY); //disable the normal array

for more info on the above commands, there is plenty of info on google.