Jump to content
  • Advertisement

Archived

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

Emon

Borked triangles

This topic is 5552 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]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
Advertisement
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
Yup, discovered that a while after posting this. Works fine now.

Thanks anyways.

Share this post


Link to post
Share on other sites

  • 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!