Hi There,
I am trying to show a colored quad on the 2D screen with the following code:
glColor3f(1.0f, 1.0f, 1.0f);
glBegin(GL_QUADS);
glVertex2f(300, 500); // vertex 1
glVertex2f(300, 300); // vertex 2
glVertex2f(600, 300); // vertex 3
glVertex2f(600, 500); // vertex 4
glEnd();
glColor3f(1.0f, 1.0f, 1.0f); // If I don’t put this, the whole screen become the previous color
Normally I would expect it to be full white, but I get an 50% gray. Is something with the blend function? Any clues what might be the problem?
Thanks
Try adding this line before glColor3f:
glDisable(GL_LIGHTING);
But of course, check all of these:
Lighting, materials, normals, shading, textures, depth testing, blending, matrix transformations, etc…
I tried disabling the lighting but it doesn’t solve the problem.
I am getting some clues. Check these 2 images:
http://www.imagitiel.com/test/quad1.jpg
http://www.imagitiel.com/test/quad2.jpg
I am drawing the 2D shapes over my 3D scene, I want to eventually make a 2D HUD. So this is giving me the impression that the white of my quad is getting blended with the very last pixel drawn from the 3D scene. If I don’t show the floor, the quad become light blue like the sky dome. If I show the floor, it then becomes gray. The fire image I am displaying however is displaying fine. But this happen if I use the instruction glColor3f(1.0f, 1.0f, 1.0f);.
Any clues?
Okay guys,
I somehow fixed the problem with
glBindTexture(GL_TEXTURE_2D, 0);
Just before drawing my shapes.