PDA

View Full Version : Painting regions



CuriosoVB
09-18-2003, 02:26 PM
Hi guys!

I'm a beginer on OpenGL. I would like to get an algorithm that to fill closed regions, by clicks of mouse.
Can you help me?

Thank you very much.

CuriosoVB - Brazil

mikael_aronsson
09-18-2003, 10:09 PM
Hi !

OpenGL is a 3D API to render 3D objects (using points, lines and triangles), filling a closed shape with color is something that 2D drawing application like paint do, and the easiest thing would be to find an open source paint application that implements this functionaility even though that might be tricky as almost all operating systems with some kind of graphics support already has this functionality built in.

If you are trying to "paint" a losed shape in 3D (using OpenGL) then you would have to use glBegin( GL_POLYGON) and draw the boundaries of the closed area with glVertex..., that would do it.

But notice that this only works for convex shapes, if you have a more complex polygon you have to use glu or some other code to simplify the polygon.

Mikael