This topic is now archived and is closed to further replies.

Borked triangles

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

I''m working on a basic program that will parse an ASCII file of a 3D model (ASE format), load the vertices and render it in a window. In the GL_POINTS mode, everything works fine. The stormtrooper ASE renders beutifully, but in GL_TRIANGLES, the faces are, well... [IMG][/IMG] I''ve narrowed the problem to my program. I''ve tried other models, other export options when making the ASE, and even another ASCII model format, always the same. I can''t figure out what''s wrong. I simply load each vertex then render them with glVertex3d(x, y, z). The vertices themselves load and render fine, but it''s as if it''s creating faces with the wrong vertices. I would have thought it would create one triangle for each three vertices, right? That''s how it was in this one test program anyways... Here''s the code that renders it. The file loading and parsing works flawlessly, I know it''s not that.
// Add some color
            glColor3f(red, green, blue);
            // Draw vertices
            for (int I = 0; I < vertexList.size() - 1; I++)
                glVertex3d(vertexList.X / 64 * scale, vertexList[I].Y / 64 * scale, vertexList[I].Z / 64 * scale);

The division by 64, by the way, is to shrink the model so it fits on the screen. This isn''t affecting the funked triangles, since it looks the same no matter what scale.     

Share this post

Link to post
Share on other sites