[SDL] SDL_ttf and opengl

Ilya Olevsky info at valengames.com
Thu Nov 1 12:18:23 PDT 2007


Sean Kerr wrote:
> Thanks. This is great information and has solidified my original thought.
> Render to individual glyph and reuse them individually. I will most likely
> be generating only a-z, A-Z, 0-9 and possibly some punctuation characters.
> That shouldn't be too bad on the texture memory usage should it?

If you're doing only ASCII, you should generate the codes from 32 to 126. Then 
you can map a char directly to a glyph.

> Could you give me a few tips on how I might generate multiple lines of
> SDL_ttf words to a single surface in SDL? Is that possible, or am I stuck
> somehow generating to multiple surfaces first and joining them somehow, and
> then extracting the pixel data? I was thinking generating a surface like
> this and loading it into texture memory:
> 
> abcdefghijklmnopqrstuvwxyz
> ABCDEFGHIJKLMNOPQRSTUVWXYZ
> 0123456789
> .!@#$%^&*
> 
> How will I get 4 lines of SDL_ttf data to a single surface like that?

You'll have to pretty much create a separate surface and blit individual SDL_ttf 
generated lines to it.



More information about the SDL mailing list