Generic model drawing

Started by
1 comment, last by AIRmichael 18 years, 1 month ago
Hi guys! :) I'm writing a li'l project which will display X3D model files. I'm having a problem with certain models I draw, some of the models have 4 vertex points, and when I draw them I need to use GL_QUADS for the to display correctly. However I want to make my project draw the models genericly, so I use GL_TRIANGLES. As far as I knew, I need to convert the quads ( or each face of the model ), into triangles. However I'm really not sure how I could covert them. Could anyone provide me with a little help on how to do this? Say for instance this is one face of a quad: glVertex(-1, 1, 1); glVertex( 1, 1, 1); glVertex( 1, -1, 1); glVertex(-1, -1, 1); I'd assume I'd need to make 6 points from the above 4? Cheers,
Advertisement
draw the quad on a piece of paper put 0,1,2,3 at the corners.
draw a line between 2 corners look at the 2 sets of points u need (in the correct order)
eg 0,1,2 2,3,0
Quote:Original post by zedzeek
draw the quad on a piece of paper put 0,1,2,3 at the corners.
draw a line between 2 corners look at the 2 sets of points u need (in the correct order)
eg 0,1,2 2,3,0


It might be better to think clock wise from each triangle:
0,1,2 0,2,3

That's also usefull for doing normal calculations etc right.

This topic is closed to new replies.

Advertisement