Jump to content
  • Advertisement
Sign in to follow this  
Kris2456

4 verts but how to do tri's

This topic is 5085 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, ive managed to get my model loading class working. But the problem is, is that the .obj modeler (anim8or). Makes the obj files store four verts too a face, not 3. This has problems, as i dont kno what too use in my vertex array. It works alright with GL_QUADS, but when the face has like 5 verts, it goes pear shaped. anyone got any ideas how i maybe should rearange the data to make tri's? thx

Share this post


Link to post
Share on other sites
Advertisement
if your face is convex, and have vertices v0,v1,v2..v[n-1]
you can draw it as triangles if you draw triangles with vertices
v0 v1 v2
v0 v2 v3
v0 v3 v4
v0 v4 v5
....
v0 v[n-2] v[n-1]
Like
for(i=2;i<n;i++){
triangles.push_back(Triangle(v[0],v[i-1],v));
}
where v[] is array that contains vertices of face, and n is number of vertices in face.

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!