how to draw wireframe polygon

i have a mesh with triangles and quads and polygons, in order to render the edges of the mesh, i need to render polygons (so do not convert to all triangles) and i konw the way using glBegin(GL_POLYGON).

but how it can be done with glDrawElements or even the vbo??

thank you very much.

Do you have any specific problems using vbo / glDrawElements ?
GL_POLYGONs can also be rendered using vbo, just pass GL_POLYGON as parameter to glDrawArrays / glDrawElements …

For using vbo in general there are plenty of tutorials - just google.

for example, the mesh has a triangle, a quad and a polygon, do i need to :
glDrawElements(GL_TRIANGLE, … tri_index);
glDrawElements(GL_TRIANGLE, … quad_index);
glDrawElements(GL_TRIANGLE, … poly_index);


What do you see as the problem in using glDrawElements or VBOs?

Also, I’m assuming you’ve tried this:

glPolygonMode ( GL_FRONT_AND_BACK, GL_LINE ) ;

?? This may be what you want – unclear. You wouldn’t do this if you wanted to suppress some of the triangle edges in your wireframe rendering.