I have to draw convex and concave polygons. By clicking the mouse, the user adds a point and the polygon updates itself.
How can I do it?
I appreciate your help.
LD
PS: Polygon in 2D
[This message has been edited by fandecine (edited 10-14-2002).]
Or render the polygon into the stencil buffer first as a triangle fan (don’t wory about the tessalation) with a StencilMask of 1 and GL_INVERT StencilOp then draw the bounding rectangle of the polygon using GL_EQUAL,1 StencilFunc. This will not be teribly efficient with lots of independent shapes because you have to clear the stencil each time, but it’s perfect for complex shapes (text for instance, this approach will take care of the holes and you can draw the whole text at once). Also if you’re clever with the StencilMask you can draw up to 8(or whatever the number of stencil bits avaiable) shapes before clearing the stencil.