Jump to content
  • Advertisement
Sign in to follow this  
Gary_80

OpenGL - triangles n' normals

This topic is 2609 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
It doesn't matter. Rendering & light will be same no matter in what order you render triangles.

Share this post


Link to post
Share on other sites
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!