[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: SDL_Flip vs SDL_UpdateRect: what's better/smoother?
On Tue, Jun 12, 2007 at 08:37:05PM +0200, voidstar wrote:
[...]
>
> Why SDL_Flip is so slow? I know that it update all the screen, but
> it's an hardware process, or not? Am I doing something wrong?
> SDL_UpdateRect doesn't wait vertical sync, it isn't?
>
I think on X11 SDL_Flip is equivalent to SDL_UpdateRect. Neither does wait
for vsync. Blitting to the screen is slow in X11. That is why many people
use OpenGL even for 2D stuff these days, even though it is overkill and
not very suitable for pixel-level manipulations...
> I also read that the sprite size should be "power of two", is it true?
> How much speed I gain doing so and why?
>
Powers of two are special if you look at their binary representation (only one
bit is set). This enables some neat tricks that are faster than "general" integer
arithmetic. But I don't think that SDL actually has special code paths for
powers of two, so it would not give you any benefit.
In OpenGL though, textures have to be 2^n sized.
> Maybe the problem is that I can't get hardware surface?
> I tried this test and it tells me that I can't get it!
> Why?!
>
Because X11 does not let you directly access the hardware.
cheers,
Christian