Jump to content
  • Advertisement
Sign in to follow this  
raphaelvanier@videotron.ca

Better alternative for font in C++ OpenGL

This topic is 2240 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 there,

I am currently using the font trick from nehe tutorial in my game:

http://nehe.gamedev.net/tutorial/bitmap_fonts/17002/ (the tutorial)

this is the result in my game:

writing1.jpg

First of all, I am applying an alpha of 0.1 to the image and text with the following code:

glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glColor4f (1,1,1, alpha);

font->glPrint(text.c_str()); // Print GL Text To The Screen
// render the image the same way.

glColor4f (1,1,1, 1.0f);

2 problem:
- The alpha blending work with the image but not with the text.
- The text is choppy and pixelized. I am using "Calibri" height 28, bold.

So... My question is, is the a better alternative to writing 2D text on the screen without these 2 problems? Other than putting my font in an image and cutting it out in tiles of course.

Thanks.

Share this post


Link to post
Share on other sites
Advertisement
You probably want to use Freetype to render your text to a texture and then just display that. Look into Texture Atlases and Knapsack heuristics if you want to really go in-depth.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!