Jump to content
  • Advertisement
Sign in to follow this  
Platinum314

OpenGL Fast Text Rendering in OpenGL ES?

This topic is 3212 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 have been working on an iPhone game for a while, and I can't put off drawing text using only the OpenGL ES routines much longer. I have been searching for tips all over the internet, but haven't found quite what I am looking for. It has been driving me crazy. I am rendering hundreds of shapes (non textured, and only 1 or two triangles each) each cycle, and speed is very important. Currently it's running at the frame rate I want without any problems. Now I want to display a hud and some other things on top of it. UILabels are too slow in my game, the Quartz routines aren't much better. People seem to like the Texture2D class that apple provides, I have managed to get it to work, but initializing these things several times per second is just too much for my program. So far the best candidate I have found is using a bitmap font and rendering each character at a time on quads. I am not concerned with variable character width or other fancy stuff. I am also trying to not use any engines like Cocos to do it for me. I don't want to put a lot of work into my own bitmap font system if there is something even better around. Has anyone here worked on anything similar?

Share this post


Link to post
Share on other sites
Advertisement
If your game is rendering a lot of text on the screen or requires dynamic text (or both) you definitely need to seriously consider rolling your own font renderer, because using UIKit or Texture2D is probably going to degrade your performance. For one reason, mainly: they treat each string as a separate texture, which is more expensive texture-memory-wise than building each string from a single texture atlas and may even effectively render the texture cache useless as soon as your game requires several strings on the screen.

Of course, creating your own font renderer from scratch takes more work than using the UIKit functionality. But, depending on your requeriments (kerning support comes to mind), and especially if you leverage existing tools, it may be easier than what it sounds. For the latest iPhone game at our company (which makes extensive use of text) we have reused part of our existing Nintendo DS toolset, but there are also good free tools on the net, such as Paul Nettle's Font File generator or AngelCode's BMFont. They both take TrueType fonts as their input, which has the nice side effect of providing easy support for non-default fonts (last time I checked, this was not the case with UIKit), support some form of kerning and have clear and documented file formats.

[Edited by - Metsan on October 31, 2009 5:07:59 AM]

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!