Results 1 to 6 of 6

Thread: Multiple Textures in Opengl... Or not?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    So thats the first one solved... If I wanted pixel dimensions, since I am currently using sdl_ttf for file format support I remember there being a sdl_getrenderedheight/width correct? I assume I could use that for spacing...
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

  2. #2
    what i did was divide texture in 28 x 32 grid for each 256-32 characters (Spacebar is no character, you can manually move caret forward). You can draw each character in the middle of their cell, so you don't need to worry about spacing and relations between them.

    For 256x256 texture it would mean 8x9 pixels for each character, leaving a little empty space at bottom. It is well enough for common fonts. 512x512 would allow more detail with 16x18 character size, at great cost of memory use. Still i'd rather use the memory for this rather than draw fonts geometrically. Simple quad will always be 100 times faster to render especially if you optimize it with arrays, displaylists or such.

  3. #3
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    The idea was to fix the slowness of nice fonts from sdl_ttf. sdl_ttf is nice for loading and thats about it. Thus if we load the font with sdl and then draw a greyscale version to a texture and the free the sdl font, we can simply do a glcolor and quad draw from the texture which should be 1.5million times faster... Still, it seems my co-ord calculations are not quite up to scratch yet as I am getting bits of garbled letters everywhere
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •