[SDL] SDL_Flip vs SDL_UpdateRect: what's better/smoother?
voidstar
voidstar at tin.it
Tue Jun 12 06:27:30 PDT 2007
> You answer your own question - it updates the whole screen which is always
> going to be slower than just updating a part of it. Are you using hardware
> surfaces? It still has to copy all the data to video memory....
Thanks for your answer. Yes I do this:
raster_bar=SDL_ConvertSurface(raster_bar, screen->format, SDL_HWSURFACE);
Yes, it has to copy all data, but my question is: ok it's a bit slower, but
why the animation is not smooth? I see some little flickering. I read that
SDL_Flip does a vertycal sync before writing to video memory and this
should avoid flickering/tearing. But, again, the animation is not smooth.
> Nope. I don't see why you need to update the whole screen anyway...
No, I don't want to update whole screen, but I was using SDL_Flip() because
it does a vertical sync (and I want it to avoid flickering/ecc).
Is there a function to wait for vertical sync? Maybe a Win32 function?
So I could call this function, and after that I call SDL_UpdateRect.
For example, when I was using SVGAlib under Linux, there was a function
called "vga_waitretrace()".
More information about the SDL
mailing list