[SDL] background / palette tricks

David Olofson david at olofson.net
Fri Nov 9 17:37:02 PST 2007


On Saturday 10 November 2007, neil at cloudsprinter.com wrote:
> 
> i'm thinking 3 layers of alpha blended 128x128 textures moving at
> different speeds across the backdrop, if the machine / my code cant
> hack it then it is disabled.

Sounds very, very, very expensive - much more so than the software 
palette thing, I'd think... Alpha blending is unfortunately not 
accelerated even in the backends that *do* accelerate opaque and 
colorkeyed blits.

(Well, there is DirectFB and glSDL, but I doubt you'd have much use 
for the former, and the latter comes in two forms: an application 
side wrapper, and a real SDL backend that never went into 1.2.)


> maybe an old school style sine wave on one layer

Did you check out the new logo and highlight effects in Kobo Deluxe 
0.4.1? They're somewhere around that level (opaque blits; one scan 
line at a time) - that is, very low cost, at least for the highlight 
effect. (The logo effect generates quite large numbers of small blits 
due to the complex region.)

I think you can have more fun than that with cleverly designed 
textures. I didn't spend all that much time tuning these effects, and 
even less time "GIMPing" the texture. For starters, it doesn't have 
to be just 1D modulation for the source. (I pick a line from the 
source based on some function involving sin() and some cubes and 
squares.) You could have a bunch of "layers" for the source, adding 
another dimension of modulation for more interesting effects.


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

.-------  http://olofson.net - Games, SDL examples  -------.
|        http://zeespace.net - 2.5D rendering engine       |
|       http://audiality.org - Music/audio engine          |
|     http://eel.olofson.net - Real time scripting         |
'--  http://www.reologica.se - Rheology instrumentation  --'


More information about the SDL mailing list