I''m attempting to make a font module that allows changing of the font colour, I have partially achieved this by using a font image that has white letters on a black background and using the NeHe Bitmap font method, for quads textured with the font in a display list. I was making the black pixels fully transparent using:
// set the blending function
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
Now I have added the glTexEnv calls (r, g and b are passed as paramaters to the host function):
// setup the font colour variables to be passed to texEnv
float rgba[4] = {(float)((1.0f / 255) * r), (float)((1.0f / 255) * g), (float)((1.0f / 255) * b), 1.0f};
// set the texture environment using the pre-calculated rgb values
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, rgba);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND);
This however turns the black pixel background to white meaning it is not occluded now. I''m relatively new to using texture blending modes so could someone tell me what I have to do/what I''m doing wrong?
Thanks in advance.