Jump to content
  • Advertisement
Sign in to follow this  

Better alternative for font in C++ OpenGL

This topic is 2338 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:


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

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.


Share this post

Link to post
Share on other sites
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.

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!