Sign in to follow this  
Gary_80

OpenGL - triangles n' normals

Recommended Posts

Gary_80    100
Hi,

if i have a cube face i.e

0---------------------1
| |
| |
| |
| |
2---------------------3

preferable i want it as two triangles with a diagonal splitting the middle,
my question is is does it mater which way the diagonal goes, and how would the triangles be ordered i.e. 0,1,2 and 213,

Also does the ordering effect the light once the normals has been calculated?

thanks :)

Share this post


Link to post
Share on other sites
lauris71    841
The order of triangles and the direction of diagonal are not important.
The order of vertices of triangle - clockwise or counterclockwise - is. At least if you are rendering solid body (and normally you are). One side of the triangle is facing outside the body, the other inside. Normally the inside facing triangles are discarded by culling.
If you calculate the normal by taking cross product of two side-vectors of the triangle, the direction of the normal also depends on the order of vertices.
Keep all your triangles in counter-clockwise order if looked from outside, and everything should be OK.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this