[SDL] Where to accquire sdl_ttf.h

John Bailo jabailo at earthlink.net
Fri Nov 28 16:58:00 PST 2003

On Wed, 2003-11-12 at 14:56, David Olofson wrote:
> On Wednesday 12 November 2003 17.08, Bob Pendleton wrote:
> [...]
> > Personally I'm starting to like the idea of a bit map based
> > allocator like the one described earlier.
> Yeah. It allows for more efficient texture space allocation, 
> especially when dealing with odd (ie non power-of-two) sizes. It 
> might have fragmentation issues with certain mixes of allocation 
> sizes and tile sizes, but OTOH, it doesn't chop up good contigous 
> space when allocating small areas.
> > If you use two layers of
> > bit maps you can solve your problem pretty well. The top layer is
> > used to allocate max texture sized textures out of the available
> > space and unused space withing those blocks can be kept track of
> > and allocated using another bit map for each block.
> I'm not sure I get the point with the top layer bit map. To keep track 
> of allocations bigger than the max texture size...? That wouldn't 
> make sense, since tiles in a surface can come from anywhere 
> physically; the only requirement is that there's some way of finding 
> them when they're needed.

Of course tiles can come from anywhere. I was thinking of them as being
"logically" sections of a larger area so that it would be easy to fit
large textures into an array of max texture size tiles using the same
algorithm that is used to place smaller textures inside of max texture
size tiles.

This way you can handle small textures being mapped into parts of
several max texture sized tiles.

So, if each of the areas below represents a max texture size tile, and
the letter regions are textures, then you can get something like:


Where you have three textures, two of which span multiple regions. (hope
fully your allocator would do a better job than this. But this is how a
left to right, top to bottom, first fit allocator would allocate these
three textures.)

Clearly, you only need to do this when max texture size is smaller than
the available memory. Not to mention that you have to make some nasty
assumptions about the amount of available memory.

OTOH, you could just put your entire memory budget into this kind on an
allocator and work from there.

		Bob Pendleton

> //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 ---
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
+ Bob Pendleton: writer and programmer. +
+ email: Bob at Pendleton.com              +
+ web:   www.GameProgrammer.com         +

More information about the SDL mailing list