tags:

views:

51

answers:

2

Is OpenGL, given a series of points, able to fill in a polygon or is this only possible by creating lots of trianges? Thanks

+3  A: 

Setting glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) should give you a filled polygon, as long as the vertices satisfy appropriate conditions (all the points have to be coplanar, and define a convex polygon, iirc).

You'd draw the polygon with the standard glBegin(GL_POLYGON), glVertex*(coords) and then glEnd() calls.

tzaman
A: 

As long as the Ngons planar and convex, OpenGL handles them well. You'll have to triangulate the polygon yourself if it becomes concave (generally) or the polygon becomes non-planar and you want some algorithm for keeping it as non-generate as possible.

voodoogiant