I copy-and-flip every animation frame at startup. Doing it before
drawing each frame would kill my framerate.
Actually, if you’re doing s/w rendering into VRAM now (and you’ll have
to do that for “live” flipping with most backends!), it won’t make
that much of a difference, except on very slow CPUs. Somewhere around
Pentium and P-II, the CPU starts working so much faster in system RAM
than in VRAM that some extra copying around in system RAM won’t make
that much of a difference.
However, one should keep in mind that antialiasing with alpha becomes
very expensive without RLE - and RLE encoding isn’t free either,
though it should be a lot faster than alpha blending every single
So I don’t think I’m doing it wrong, it’s just that I have a TON of
Well, “wrong” was a bit harch; it really depends on what you need, and
what kind of hardware you can expect or require. If you’re very low
on both CPU and memory, there’s basically no way around implementing
true “flip blitters”, one way or another.
In my case, and for many others, I’d gladly trade a 100KB increase
in the (uncompressed) lib size for the kind of memory footprint
reduction I’d get. But I understand the concern.
Yeah… One could make it a compile time option, disabled by default,
but I don’t like that either… Stuff should be used (which means
properly tested and known to work), or it shouldn’t be there at all,
And in this case I’m not sure a separate lib would do, since many
SDL_Surface members are supposed to be opaque outside the SDL code
itself. What to do, what to do…
Actually, the only problems are RLE and h/w accelerated backends. For
all other cases (ie plain s/w blitting), you don’t need to mess with
anything that’s not public and documented.
And I’m not even sure any significant accelerated 2D APIs support
flipping anyway… Well, there is glSDL, but OTOH, if you can use
that, can you really be running on a system where it would matter how
you implemented the flipping? Then again, that depends on how much
graphics we’re talking about.
Anyway, RLE is probably the hardest one. Unfortunately, it’s probably
also the one you need the most, since that’s what you get whenever
you use alpha, or run on a platform without accelerated 2D rendering.
And alpha (for AA) is where RLE really helps…
//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 —On Sunday 03 April 2005 22.17, Gabriel wrote: