PDA

View Full Version : Normals for GL_TRIANGLE_STRIP



Milo
02-18-2003, 08:37 PM
Hi,
I am trying to implement lighting in a program. I have written a function which calculates a normal to a polygon given 2 vectors of the polygon. Now the program has a lot of triangles defined using GL_TRIANGLE_STRIP. Will I have to call the normal calculation function for each of the triangle (it is very tedious) or is there an intelligent method to overcome this ?

any ideas...
Milo

MichaelNewman
02-18-2003, 09:17 PM
Unless your surface is defined by some sort of function and you can find it's tangent at a point I think your out of luck. At least if your surface is static you only have to compute the normals once, but I'm guessing yours is not http://www.opengl.org/discussion_boards/ubb/frown.gif

Miguel_dup1
02-19-2003, 10:33 PM
You will have to compute every normal for every polygon you draw unless if you have pre-computed them and saved them... I dont know what kind of drawing you are doing, but it is generally simple. Normals are independent of how many calls to glBegin( POLY_TYPE ) you make.

Good luck

Miguel Castillo



Originally posted by Milo:
Hi,
I am trying to implement lighting in a program. I have written a function which calculates a normal to a polygon given 2 vectors of the polygon. Now the program has a lot of triangles defined using GL_TRIANGLE_STRIP. Will I have to call the normal calculation function for each of the triangle (it is very tedious) or is there an intelligent method to overcome this ?

any ideas...
Milo



[This message has been edited by mancha (edited 02-20-2003).]