View Full Version : Drawing Faces from 3DS file

10-23-2011, 03:20 PM
So I just implemented the ability to load vertices and faces from a 3DS file, and it mostly works, with one aspect that has me scratching my head. I am using the following loop to draw the faces after loading a model. The issue is that the model seems to display numerous extra edges when viewing in a wireframe mode. I have checked multiple models and have seen this throughout, I am wondering if anyone has any suggestions on how to fix my problem.

for(int x = 1; x < 4*numberOfTriangles+1; x++)
//Face bit modifiers not needed, skip em.
if(tLoop == 4)
tLoop = 0;

And the following is an example of what I am asking about.

10-23-2011, 04:38 PM
I don't think your loop looks right. Doesn't x have to increase by 3 on each iteration?

10-23-2011, 05:03 PM
If I was drawing 3 vertices per loop it would, but I'm only drawing a single vertex per loop.

10-24-2011, 05:33 PM
Figured out my own problem. Notice how the begin and end blocks appear outside of the loop. The program was trying to draw triangles using every vertex in the mesh, one after another. Thus it kinda created one giant mess. I changed to placing three vertices at a time(one face), and I placed the begin/end blocks inside the loop, and changed the loop to increment by 4 each time, allowing me to skip the face data.

Just in case anyone was curious.