Hello,
I currently have a program that prints to the screen using the bitmap font technique. On the bitmap the background is black and the characters are white. Because of this I can enable blending, call glBlendFunc(GL_ONE, GL_ONE) and do a glColor4f(…) to print in any color I choose. This works fine.
The problem arises when I add a background texture and then try to print to the screen. I can no longer print in the color I want. For example, I add the background texture, then do a glColor4f(1.0f,0.0f,0.0f,1.0f) (since I want red text) then do a call to my print function. The text prints, however, it’s not red, it’s more a light red, a pinkish red if you will. I’m not sure if the problem has to do with my texture environment or my blending function.
Here’s some code:
[b]
bool Font::RenderScene()
{
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE);
DrawQuad(-1.0f,-1.0f,1.0f,1.0f,textures[0]); //background texture
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
glColor4f(1.0f, 0.0f, 0.0f, 1.0f); //red text
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
arial->Print(-0.9f, 0.6f, "Hello World!");
return true;
}
[/b]
[/b][/QUOTE]
again, the color of the text works if i don't add the background texture. however, when i do add the background texture, the color is always lighter than its suppose to be. Any ideas? Thank in advance.
Regards,
JQ