[…]
Isn’t there also a flag you need to set to get things like hardware
accelerated blits and such? SDL_HWACCEL or something?
No, unless I’m mistaken, you simply get h/w acceleration whenever the
circumtances are right; ie when the backend and driver supports
accelerated blits from your source surfaceformat and memory type
(VRAM or system memory) to your destination format and memory type.
Anything else falls back to s/w rendering.
As to the SDL_Flip() thing, to me it seems that SDL never does true
page flipping; rather, it just copies the back buffer to the front
buffer. At least, this is how it seems on some hardware.
It certainly seems to do true page flipping on DirectX/Win32 on all
h/w I’ve tried it on so far…
If you’re on Linux, you don’t have many targets and drivers that can
do h/w page flipping at all, though.
Also note that very few video subsystems support h/w page flipping in
windowed mode.
It would
therefor make sense that doing SDL_UpdateRects() would be faster,
since you would only be blitting part of the back buffer to the
front buffer instead of the whole thing.
…unless you’re scrolling the whole screen.
Try using SDL_SWSURFACE|SDL_DOUBLEBUF instead, and see if that’s
faster.
In SDL_video.h:
#define SDL_SWSURFACE 0x00000000 <==
#define SDL_HWSURFACE 0x00000001
…
#define SDL_DOUBLEBUF 0x40000000
Somewhere in SDL_video.c:
if ( (flags&SDL_DOUBLEBUF) == SDL_DOUBLEBUF ) {
/* Use hardware surfaces when double-buffering */
flags |= SDL_HWSURFACE;
}
So, that should be equivalent to SDL_HWSURFACE|SDL_DOUBLEBUF, or just
plain SDL_DOUBLEBUF. What you get is a double buffered h/w surface,
provided the API and driver support it.
//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 Thursday 22 April 2004 05.05, Sean Ridenour wrote: