Problem drawing a cube

I am trying to import a cube in the direct x format exported from blender. i wrote the importer and stored all of the vertex coordinates. i have checked to make sure the coordinates are correct after storing them and they are. Everything seems to line up, but when I render them, they look like this:

From the looks of it, the first triangle(in the back) is rendered correctly, but the next one is scaled, and possibly translated (the translation could be due to scaling), and the next one is scaled a little more and translated a little more, and so on and so forth. Any idea what could be causing this? I included my draw function in the image.

Thanks in advance :slight_smile:

Edit: forum scaled the image and made text unreadable. Here is a link to it

Please post code snippets in the forum, surrounded with [ code]/[ /code] (no space after ‘[’), to avoid any readability issues, thanks.

Your loop over the triangles starts with a glTranslate() call, those accumulate in the modelview matrix, you probably want to do this outside the loop.

thanks, that did the trick. sorry about the formatting issue, i will use the proper formatting next time.