in a wavefront object file (.obj) how am i supposed to render faces with more than 4 vertices in opengl?

后端 未结 3 962
别跟我提以往
别跟我提以往 2021-01-12 16:27

So using a Wavefront object file how am i supposed to render faces that have more than 4 vertices in OpenGL?

I understand that if it has 3 vertices I use GL_TR

3条回答
  •  借酒劲吻你
    2021-01-12 17:12

    OBJ exporters will export the vertices in a sane order for each face (anti-/clockwise), and long as your faces are coplanar and convex (which they bloody should be!) - you can use GL_TRIANGLE_FAN.

    I disagree with Nicol Bolas' point that faces should always have 3 vertices, although fool proof, if your polygons follow the above rules, using GL_TRIANGLE_FAN simplifies your code and reduces system memory consumption. Nothing will change GPU side as the polygons will be decomposed to triangles anyway.

提交回复
热议问题