Sign in to follow this  
jimdaddy

Generic model drawing

Recommended Posts

jimdaddy    122
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,

Share this post


Link to post
Share on other sites
zedzeek    529
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

Share this post


Link to post
Share on other sites
AIRmichael    136
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.

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