PDA

View Full Version : GLDrawElements and Polygons



scrythe
01-08-2004, 05:40 PM
Hi,
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.

soconne
01-08-2004, 11:43 PM
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.

Bob
01-08-2004, 11:48 PM
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.

scrythe
01-09-2004, 01:26 AM
Thanks for the advice.