Original Post
I'm drawing a rectangle like this:
glBegin(GL_QUADS);
glColor4f(color1.r / 255.0, color1.g / 255.0, color1.b / 255.0, color1.a / 255.0);
glVertex3d(x2, h - y1, 1);
glColor4f(color2.r / 255.0, color2.g / 255.0, color2.b / 255.0, color2.a / 255.0);
glVertex3d(x1, h - y1, 1);
glColor4f(color3.r / 255.0, color3.g / 255.0, color3.b / 255.0, color3.a / 255.0);
glVertex3d(x1, h - y2, 1);
glColor4f(color4.r / 255.0, color4.g / 255.0, color4.b / 255.0, color4.a / 255.0);
glVertex3d(x2, h - y2, 1);
glEnd();
I expected every corner of the rectangle would have another color (see, there's color1, color2, color3 and color4), but it doesn't work: instead, the whole rectangle has color4. What is it supposed to do? In the nehe tutorials, it works for the triangle with blue, red and green corners... Before drawing the rectangle, I already do the following OpenGL commands (It's a 2D engine btw):
glShadeModel(GL_FLAT);
glCullFace(GL_BACK);
glFrontFace(GL_CCW);
glClearColor(0, 0, 0, 0);
glViewport(0, 0, screenWidth, screenHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, screenWidth, 0, screenHeight, -1024, 1024);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);