Jump to content
  • Advertisement

Archived

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

zedd

Colored textured font

This topic is 6239 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

Hi I''m using textured font to draw text over my background scene. I use a black and white texture with anti-aliased characters and an alpha channel to make the black part transparent. It works fine but i''d like to be able to change the text color without having to load anything else (ie replace the white of the character by another color). Of course the text should still be blended correctly with the background. Is there a simple way to do this? thanks zedd

Share this post


Link to post
Share on other sites
Advertisement
One of the common methods (and the way I do it) is to use vertex lighting. If you have a solid white texture and specify red light on it, it will turn it red (of course).

Share this post


Link to post
Share on other sites
provided u have the alpha channel of the etxture setup well
use
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glDisable( GL_LIGHTING )
glColor4f(1,0,0, 1) // for red
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA. GL_ONE_MINUS_SRC_ALPHA )


http://members.xoom.com/myBollux

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!