Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Font Textures and Blending in Colours

This topic is 5508 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
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.

Share this post

Link to post
Share on other sites
I use


in the font printing function and set the colour



before calling the print function.. this allows me to use the black and white font bitmap and draw it in any colour (including BLACK)..

Jumpman - Under Construction

Share this post

Link to post
Share on other sites
Yes... that was always an alternative to the way I had mentioned - thanks Jumpman, however, for the sake of completeness and so I know it actually *can* be done, can anyone tell me how to do it the glTexEnv way?

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!