[SDL] What is wrong with SDL_TTF?

David Olofson david at olofson.net
Mon Sep 12 14:34:51 PDT 2005

On Monday 12 September 2005 22.20, kds71 wrote:
> Now I need to render text in SDL, not using OpenGL. But some time
> ago I was writting application in SDL and OpenGL (using SDL_TTF,
> too). I quickly realised that I will need to render each glyph
> separatly. So I wrote class TFont, which loads and initializes font,
> creates textures, OpenGL lists and so on. This class provides
> methods for render text and metrics. Code was testing on same
> machines - and: 
> - on Sempron 2500+ (256 mb ram, geforce 4) - 60 fps
> - on Pentium II 450 mhz (320 mb ram, geforce 2) - 55-60 fps
> - on Duron 800 mhz (256 mb ram, riva 2) - 3-4 fps!!

Well, assuming the two faster machines are limiting the frame rate to 
the 60 Hz refresh rate (retrace sync), there must be something very 
wrong with the setup or something on the Duron.

Are you sure the driver actually provided hardware acceleration for 
the pixel format you were using? Did other OpenGL software run with 
decent frame rates on that system? Maybe your code relied on some 
feature that wasn't supported by the Riva 2 card... Some odd blending 
mode, texture filtering or something that that chip cannot 

Either way, with a design like that (prerendered glyphs), SDL_TTF 
should be out of the loop (literally!) once you've rendered your 
fonts. So, if it's still slow, it should have nothing to do with TTF 
rendering, unless you put some code in the wrong place...

//David Olofson - Programmer, Composer, Open Source Advocate

.- Audiality -----------------------------------------------.
|  Free/Open Source audio engine for games and multimedia.  |
| MIDI, modular synthesis, real time effects, scripting,... |
`-----------------------------------> http://audiality.org -'
   --- http://olofson.net --- http://www.reologica.se ---

More information about the SDL mailing list