Advertisement

Borked triangles

Started by May 06, 2003 08:58 PM
1 comment, last by Emon 21 years, 9 months ago
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.Y / 64 * scale, vertexList.Z / 64 * scale);
</pre>

The division by 64, by the way, is to shrink the model so it fits &#111;n the screen. This isn''t affecting the funked triangles, since it looks the same no matter what scale.  </i>   </pre> 
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 - |
Advertisement
Yup, discovered that a while after posting this. Works fine now.

Thanks anyways.

This topic is closed to new replies.

Advertisement