PDA

View Full Version : Example of 2D (or 3D) complex polygon fill



louhough
05-07-2006, 10:41 AM
Am just starting out using OpenGL and need a good example of a complex polygon fill (one with may sides). Am at present drawing maps with such features as cities, counties, and lakes (having many sided polgons). Polygons at present don't have interior exclusion areas.

k_szczech
05-07-2006, 03:10 PM
Your biggest problem will be nonconvex polygons. I googled for:
GL_POLYGON nonconvex
to find an usefull article and I found this pdf for beginning:
http://bit.csc.lsu.edu/~karki/SV-06/SV_Drawing.pdf
It doesn't describe how to deal with nonconvex polygons, but it explains drawing polygons, line stipple and more things that can be usefull for maps.
Also - interior exclusion areas can be simply implemented by drawing a polygon with background color.
If you run into problems with nonconvex polygons, then perhaps we can talk about it. Righ now I'm leaving it up to you.

Best regards

Verio Fryar
05-08-2006, 03:40 AM
You can use the GLU tesselator. Look gluTessBeginPolygon, gluTessCallback, ...