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?
There is the GLU tesselator, unless you have something against that.
It is slow, just like many tesselators.
Do you have a dynamic object?
Yes. The vertex can be added or remove dynamic
A method for managing concave polygons with holes is given in:
Ferguson, Stuart “Practical Algorithms for 3D Computer Graphics”
Chapter 7.2 (p 254): “Triangulating Polygons With Holes”
BTW, am I wrong in thinking that that the glu tesselator only handles convex polygons?
The gluTessBeginPolygon and gluTessEndPolygon functions delimit the definition of a nonconvex polygon. Within each gluTessBeginPolygon/gluTessEndPolygon pair, include one or more calls to gluTessBeginContour/gluTessEndContour. Within each contour, there are zero or more calls to gluTessVertex. The vertices specify a closed contour (the last vertex of each contour is automatically linked to the first).
Try this (the example is 2D but work fine in 3D also…) http://www.codeproject.com/useritems/polygon_tesselation.asp