How to draw 2d polygons in OpenGL

Hi,
I tested the OpenGL polygon mode. It seems the following piece of code just draw a convex polygon:

glBegin(GL_POLYGON);
nVert = p->numVert();
for(i=0; i<nVert; i++)
{
x = p->x(i);
y = p->y(i);
glVertex2f((GLfloat)x, (GLfloat)y);
}
glEnd();
Any pointers how to draw a non-convex polygon in OpenGL?

Thanks

Hi !

OpenGL itself can only render simple polygons (convex, no overlaps and no holes), if you need non convex polygons you have to break it down into triangles yourself or use the GLU tesselator.

Mikael