Advertisement

Super slow bitmap fonts

Started by July 17, 2005 03:14 AM
4 comments, last by GameDev.net 19 years, 1 month ago
Im using the method in Lesson 13 to display text in bitmap fonts, and it seems ridiculously costly. There is enough room on the screen to display 38 lines of text on the screen. If im not displaying any, i get 80-85 fps. With all 38 lines displayed, however, it drops down to 20 fps. Is this method supposed to be this slow? Is there some way to speed things up? Thanks.
yup, texture fonts (lesson 17 I believe)
3d graphics cards are kinda optimised for polygon texture rendering, they are not for bitmapping ;]
_______________________________ ________ _____ ___ __ _`By offloading cognitive load to the computer, programmers are able to design more elegant systems' - Unununium OS regarding Python
Advertisement
Mmmm i see, thanks, ill give that a try. BTW, are texture fonts faster, or the FreeType fonts of lesson 43?
Okay the freetype library is just a loading mechanism
Once you've got the data it's upto you how you display it

But basically using textures is the only real feasible method.
13 probally would of too, but was probally skipped to keep the tutorial smaller & such

Bitmap font's are silly :P
They're slower & they're only 1bit (straight black or white, no antialiasing/blending)

They're not really used, & were probally just put in the tutorial for simplicity since there's a premade function for generating them

But as far as font display really goes the only other (actually feasible solution) is allocating the fonts as texture data & applying it to polygons (unless you wanna use vector, but that's kinda silly too :P)

tut 43 just uses the freetype library to generate textures - so they're "texture fonts" too ;]

The bit that freetype actually does is generate the texture data from the fonts itself rather than using premade textures (like in 17)



Graphics programming is weird - you get your 3d cube first & your hello world last o0
_______________________________ ________ _____ ___ __ _`By offloading cognitive load to the computer, programmers are able to design more elegant systems' - Unununium OS regarding Python
Using FreeType to load fonts is a simple and efficient way to do it. Actually rendering the fonts is where the bottleneck might appear. The FreeType font lesson can be easily optimized. The problem is that there is one texture per glyph, and that for each character the texture needs to be changed. That is expensive, and can explain why you're getting 20 fps while rendering only a few hundred glyphs.

A much better solution is to render all the glyphs into a single large texture, and then make smart use of texture coordinates to isolate and render each glyph. Thus, when you want to render a string of text, you only make a single texture switch.

There are also other things you can do with the FreeType library that are not demonstrated in the NeHe lesson. Features such as kerning, for instance, which is not difficult and will likely improve the layout of the text rendered. You can read more about it in the FreeType tutorials and documentation.
a question about this:

I'm already using texture fonts in my engine, but I'm thinking in supporting asian fonts... how am I supposed to do that? I don't think there's a texture size big enough to support the full kanji set in a single texture.

How DirectX handles fonts internally? any idea of how works D3DXfonts?

-VicViper


Quote: Original post by James Trotter
Using FreeType to load fonts is a simple and efficient way to do it. Actually rendering the fonts is where the bottleneck might appear. The FreeType font lesson can be easily optimized. The problem is that there is one texture per glyph, and that for each character the texture needs to be changed. That is expensive, and can explain why you're getting 20 fps while rendering only a few hundred glyphs.

A much better solution is to render all the glyphs into a single large texture, and then make smart use of texture coordinates to isolate and render each glyph. Thus, when you want to render a string of text, you only make a single texture switch.

There are also other things you can do with the FreeType library that are not demonstrated in the NeHe lesson. Features such as kerning, for instance, which is not difficult and will likely improve the layout of the text rendered. You can read more about it in the FreeType tutorials and documentation.


This topic is closed to new replies.

Advertisement