PDA

View Full Version : filling polygons



lakgani
04-25-2008, 12:43 AM
hi

is there any need to use scan line algorithm to fill irregular polygons??
if so,can anybody guide me?
i will be greatfull if anybody give the example source code!!

thankyou.

Zengar
04-25-2008, 01:20 AM
OpenGL fills the primitives you render automatically (if you are in the FILL mode and are not drawing stuff like lines or points). I am not sure what you mean by "irregular" polygons, but I take, you refer to non-convex polygons. In this case I have to point out that GL does not render such polygons at all --- you will have to convert them to triangles first.

lakgani
04-25-2008, 01:39 AM
I have some vertices,linecolors and fillcolors for each vertex and they may be more than one vertex array which can construct a car image!! i want to use opengl to render these points.but i dont know what primitives have to be used in opengl.
i simply using glBegin(GL_POLYGON) ,glColor3f(fillcolor)and passing all vertices in a array then glEND()... repeating same process till all arrays passed as i treat each array as a polygon with filling colors.

all colors are not same.and line colors also there.how can i render these vertices in opengl.

am i going in right way??

please guide me to do this.

thankyou