[SDL] What is wrong with SDL_TTF?
rpmcruz at clix.pt
Tue Sep 13 01:59:41 PDT 2005
In my opinion, instead of converting TTF fonts to bitmaps in run-time you
should do so before to avoid extra dependecy, make the engine simpler and use
of less cpu and memory.
Making a program to convert TTF to a bitmap is very simple, as well as making
it accept arguments and add graphical effects.
Em Segunda, 12 de Setembro de 2005 18:32, o Bob Pendleton escreveu:
> On Mon, 2005-09-12 at 16:46 +0200, kds71 wrote:
> > Hello everybody!
> > I'm trying to use SDL_TTF to render a lot of text. But it's extremally
> > slow. On Sempron 2500+ 256 mb ram GeForce 4 it is running great. On
> > Duron 800 128 mb ram Riva 2 I have about 50 fps - it's acceptable. But
> > on Pentium III 450 mhz 320 mb ram I have for 10 to 25 fps.
> > 1) Why it's so slow?
> Because it is doing some very fussy software rendering. That takes time,
> it can take a lot of time.
> The way to make it fast is to render the individual glyphs and store
> them. Then draw text by blitting the individual glyphs to the screen. If
> you are using OpenGL, then store them a textures and then texture map
> them into place. You either render each glyph as its own surface, or you
> can render the entire font into a surface and blit the appropriate parts
> of you font surface.
> The metrics you need to use to draw the text are all available through
> If you search on this subject and with my email address in the SDL
> mailing list you will find a C++ class that I posted here awhile back
> that implements this technique.
> > 2) It's possible to render more than one line of text on one surface?
> Not that I know of. And, like I said, that wouldn't be a good way to
> solve the problem.
> > 3) Is there any portable alternative way to render text with SDL?
> Sure, many of them. Lots of SDL font libraries out there. You can find
> one I wrote at http://gameprogrammer.com/fastevents/fastevents1.html
> but, really, rendering the individual glyphs and bliting them into place
> is great for most applications
> Bob Pendleton
> > Thanks a lot.
We have more to fear from the bungling of the incompetent than from the
machinations of the wicked.
More information about the SDL