Screen flashing with double buffering

I have a loop that draws nothing and doesn’t even call my own functions.
The loop is a for-loop that goes for 600 times and calls SDL_Flip(); This
is my screen surface init:

SDL_Surface *screen = SDL_SetVideoMode(800, 600, 32, SDL_HWSURFACE |

the screen starts flashing from white to black and black to white after
about 400 times or something. This wouldn’t bother otherwise because
you’re suppose to draw into the screen, right? But when the flashing
starts at the background, the first white screen shows over my blittings
and the screen quickly flashes white and then goes on normally. This
isn’t a problem that I couldn’t live with, but I was wondering that maybe
drawing screen from black to white and back might slow the program?
Anyway, what is this?

Btw, thank you for everyone for this list, this really is something that I
should be with every library because I wouldn’t be in this phase of my
game without this.


yes, it is true. I did get about the same problem with a “for loop”, but
with a “while loop” it does not exist !!

problem is : i launch the program, a few seconds after, the screen goes to
white and come back imediatly as before.

I discover this with the code from “Programming Linux Games”, page 104, code
listing 4-7 (sdl-anim2.c). go to line : for (frames = 0; frames < 300;
frames++) {
Now write …; frames < 2000; …

you will see this problem…but if you do not want to see this problem
change the “for loop” to a “while loop”

I use VC6++ & pack 5.
256 ram pc133
hercules prophet 2mx
latest drivers


MSN Photos est le moyen le plus simple de partager, modifier et imprimer vos
photos pr?f?r?es.