Color of a G_QUAD

Hi!
I am defining for each vertex of Quad a color. If GL_SMOOTH is enabled the color distribution looks fine, but if i switch to GL_FLAT the color of the QUAD is strange. How does opengl decide, which color of the verteces of the quad is used to display??
Thanks
Juergen

The color of the first vertex that builds the primitive will be used to shade the whole primitive.

glBegin(GL_QUADS)
glColor(red);
glVertex(v0);
glColor(green);
glVertex(v1);
glColor(blue);
glVertex(v2);
glColor(yellow);
glVertex(v3);

With smooth shading, the four colors should be interpolated over the quad. With flat shading, the whole quad should be red, cause thats the color of the fist vertex in the quad.

I think it will be yellow in your example, the last color before completion.

Ah, yes, you are right. It’s the last color, not the first, that defines the color of the primitive. Sorry.