vertex arrays and tri fans

Hi,

I’m working on reading a 3d model file. The model contains both triangle strips and triangle fans. I load each primitive type into an array and then render each array using glDrawElements(). My problem is that all my triangle fan vertexes connect to the first vertex. How do i tell opengl that they are seperate polygons with a vertex array?

Example:
tri_fan_indices[]=
{0, // becomes origin of fan.
1, // all indices connect to origin
2,
3,
4, // 4 should start an entire new triangle fan but instead connects to index 0
5,

n};

Thanks

Just use a new glDrawElements calls.

You just change the start point and the size of the array.

glDrawElements isn’t for saving drawings calls, it is for saving transformations over multiple pass because the transformations won’t be done again. I am not sure if the vertex array used in unextended opengl does that, but the extension compiled vertex array does.

If you use just one pass, you do better stick with glVertex calls and Display lists