views:

68

answers:

1

I started learning about reading the data packed in a Collada file (.dae). I'm to the point where I have the vertices of a specific mesh. Right now, I'm just looping through them between calls to glBegin and glEnd, and I noticed that not all of the faces were being rendered. I think it might be because the vertices aren't in the correct order to form a valid triangle strip. I realized that maybe this question should be aimed at the blender .dae exporter, since that's what I'm using.

This is the exact code I'm using:

//Vertices is a vector of vertices that I pulled from the collada file.

glBegin(GL_TRIANGLE_STRIP);
for(int i = 0; i != Vertices.size(); i++)
{
    glVertex3f(Vertices[i]->x, Vertices[i]->y, Vertices[i]->z);
}
glEnd();

The model I'm trying to load is a simple plane. Here's the contents of Vertices:

1: 1, 1, 0
2: 1, -1, 0
3: -1, -1, 0
4: -1, 1, 0
A: 

You're right this is not a valid triangle strip if you want to draw a simple plane.

You should draw your vertices in that orders:

1: 1, 1, 0
2: 1, -1, 0
4: -1, 1, 0
3: -1, -1, 0

What you are drawing is that:

    4      1 
    |\    /|
    | \  / |
    |  \/  |
    |  /\  |
    | /  \ |
    |/____\|
    3      2

Looks like a problem in the exporter..

Stringer Bell