GLDrawElements and Polygons

I have a list of polygons(which vary in there number of vertices) which I grab from a file and was hopeing to use a combination of gl*Pointer and glDrawElements to display these, but from looking at the opengl man pages for glDrawElements (-type= GL_POLYGON because a varying number of vertices) you supply a list of Indices but this will only draw a single polygon, Is there any way to supply seperate faces in the indice pointer say a value of -1 for each new face? so that I can still batch process the Vertices.

Why not simply convert each of your polygons into triangles, that way you can simply pass GL_TRIANGLES to glDrawElements and not worry about the polygon problem.

It’s called GL_POLYGON, not GL_POLYGONS. If you take a closer look at the enums you can pass to glDrawElements, you will notice that some enums indicate one primitive, some enums indicate several primitives. For example, you can draw several points and triangles, but only one line loop and one triangle strip.

So sorry, no, you cannot draw several polygons at once. But you can preprocess your polygons, and split them into separate tringles.

Thanks for the advice.