Archived

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

Emon

Borked triangles

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]http://www.nervecore.org:800/emonsbox/screenshots/aseview00_bad.gif[/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);
[/CODE]

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
you will probably find there is an index array that you should be using for vertex indices. but I could be wrong, I havn''t worked with .ase''s before.

| - Project-X - my mega project.. close... - | - adDeath - | - email me - |

Share this post


Link to post
Share on other sites