Freetype Font Rendering

Started by
0 comments, last by soconne 15 years, 11 months ago
So I've been trying to find a good way to render text in OpenGL, and I've finally come across the Freetype Library. I have gone through their tutorials and finally know how to create the bitmaps necessary for rendering the text. The question is this: what's the best way to render these bitmaps? When I load a font, should I create an array of textures, one for each character in the font, and then call the textures I need to render a string? This would also require me to store the width and height for the letters (not the textures, the letters have smaller widths and heights than the textures because the textures have to be padded to a power of 2). Is there a better way or should I just start coding? I just hesitate about this method because it would require me to generate a whole new set of textures if the font size was different or anything like that, plus I don't know how efficient it is. Thanks!
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
Advertisement
Store all the characters in a single texture and store the x, y, width, height values for each character. Then when rendering a string, bind the texture once and for each character, lookup the correct texture coordinates and render a quad per character.
Author Freeworld3Dhttp://www.freeworld3d.org

This topic is closed to new replies.

Advertisement