1 - SDL_DOUBLEBUFFER and redraw all the sprites at frame. this
2 - No Doublebuffer and actualize all the sprites in the screen and then
SDL_Update…()
3 - Other
1 - SDL_DOUBLEBUFFER and redraw all the sprites at frame. this
2 - No Doublebuffer and actualize all the sprites in the screen and then
SDL_Update…()
3 - Other
i guess it is solution 1
1 - SDL_DOUBLEBUFFER and redraw all the sprites at frame. this
as swap buffer (if your card, as all new card provide this, is a very
loaw cost operation) provide a far more better user experience.
Depends… If you have a scrolling background, or lots of sprites,
1 definitely provides the best simplicity/performance ratio. Unless
you have a real time OS and retrace sync support, you should also use
method 1, as you can’t avoid tearing otherwise.
Method 2 may even give you flickering, unless you blit only “finished
rectangles” to screen, rather than doing the usual { remove sprites;
run control system; draw sprites; } loop.
My method 3 proposal would be a way of fixing method 2 by going
halfway back to method 1. Run that { remove sprites; run control
system; draw sprites; } loop on the background buffer, and then use
SDL_UpdateRects() to refresh the areas that have changed since the
last frame. Do note that SDL doesn’t merge overlapping rects, so
you should do that if you have enough overlapping sprites to
warrant the effort.
//David
.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |
--------------------------------------> david at linuxdj.com -'On Saturday 14 July 2001 22:42, Luis Cabellos wrote:
1 - SDL_DOUBLEBUFFER and redraw all the sprites at frame. this
2 - No Doublebuffer and actualize all the sprites in the screen and
then SDL_Update…()3 - Other
1 - SDL_DOUBLEBUFFER and redraw all the sprites at frame. this
as swap buffer (if your card, as all new card provide this, is a very
loaw cost operation) provide a far more better user experience.
the video target must support it as well (X11 doesn’t). The wise programmer
uses UpdateRects() with software surfaces if hardware surfaces with
page-flipping is not available
also keep in mind that alpha blitting is typically much slower to hardware
surfaces