I am very new to SDL and this is my first post to this list, so pardon
me if this question is silly or, otherwise, common knowledge among
I have a limited experience with DirectX, having done some simple
explorarions with DirectDraw. The basic procedure I would follow to
- initialize DirectDraw;
- set the video mode;
- create the the primary surface (the video’s frame buffer);
- and get an “attached surface” from the primary surface
(the back buffer)
The “attached surface” would have the same characteristics as the
primary one (same dimensions, same color depth, etc.). From that point
on, the back buffer would be the target of the blits to compose a
scene and it would be swapped with the primary surface at each [game]
It would be possible, as well, not to have made use of a back buffer
at all. One could lock the primary surface and write to it directly.
However, one would always be advised to go for the flipping approach,
to get rid of flickering, tearing and other annoying side-effects.
For what I have been able to see in SDL, so far, it appears it also
offers both possibilities. For my first application, I am simply
drawing to the screen surface (primary surface) and then calling
update to force the region to be repainted. I would think that using
flipping would be a better choice, specially when the scenes become
more complex. Is that so?
Another question: I have noticed that, with SDL, there is no need to
control the repainting of the client area’s contents, i.e. after you
write something on the screen, it seems as though SDL takes care of
restoring the images for you, either when you put some other window on
top of yours or move the application window out of the desktop. And
this happens without having the drawing code inside the loop, i.e. it
runs only once. Is this right or could I be overlooking something in
my own code?
Thank you very much for your attention and clarifications,
Ney Andr? de Mello Zunino.
“Take of the fruit,
But guard the seed…”