Jump to content
  • Advertisement
Sign in to follow this  
jimdaddy

Generic model drawing

This topic is 4456 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 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
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

Share this post


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

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!