HELP:knows how to draw concave polygons quickly???

Does anyone know how to draw concave polygons quickly? I mean that I just have a list of vertexes, but I don’t know if it is a simple polygon or not. And perhaps there are one or more holes in it. You know, OpenGL could not do it automatically. Could you tell me what shall I do? GlUT or other ways?

Hi !

Use the glu tesselator code, it can handle almost any kind of polygons (concave and with holes), have a look at the gluTessBeginPolygon, gluTessBeginContour, gluTessCallback and so on.

You should not use it to do the rendering though, it might be to slow, use it to put the result in a displaylist or something else so that you can render it fast later on.

Mikael

Thanks for your replay.
I am thinking about this problem:
First I can check the polygon’s vertexs, make sure that it is concave or convex. if it is a simple polygon, draw it directly. If it is a complex one, draw it by GLUT. there are not so many concave polygons or with one or more holes I think. So it would be faster. Do you think so? But how to judge it is concave or not fastest?
Thanks for you help!

Hi !

Not GLUT, glu, this is the “utility” library that comes with OpenGL.

Can’t you just send them all through glu and create a displaylist for example ?, I don’t know how to detect concave/convex state of a polygon, but most raytracers that support concave polygons have two parts, one for convex and one for concave polygons, maybe you could have a look at the source for one of those raytracers maybe ?

Mikael