color fill... pls help

currently i had done drawing tis polygon

glBegin(GL_POLYGON); // Draw A polygon
glVertex3f(1.5f, 0.0f, 0.0f);
glVertex3f(1.0f, 1.0f, 0.0f);
glVertex3f(1.5f, 0.5f, 0.0f);
glVertex3f(0.5f, 1.0f, 0.0f);
glVertex3f(1.0f, 0.0f, 0.0f);
glVertex3f(0.5f, 0.0f, 0.0f);

now i wana to do color filling with two algorithm which is scan-line and boundry-fill. can anyone help me with this ?

On OpenGL you don’t fill the polygon by hand, you can specify the color for the next vertex with one of the glColor functions.
Another way to give color to your polygon is by using a Texture.

There is also another way of controlling the color of each, by using a fragment program.

I don’t think this answer will help him with his assignment. :slight_smile:
Oh and btw, please don’t crosspost, Never.