[SDL] Re: CPU Usage

Clemens Kirchgatterer clemens at 1541.org
Sat Jul 30 03:05:44 PDT 2005


Diaa Sami <diaasami at yahoo.com> wrote:

> I'm drawing transparent images over 70% of the screen.
> but the FPS is low even without drawing(and without the limiter, of
> course)
> 
> when I draw nothing to the screen and turn off the fps limiter, I get 
> around 95 fps.
> the code:
> 
> 	// SDL setup
> 	screen = SDL_SetVideoMode(640, 480, 0, SDL_HWSURFACE);
> 	
> 	// drawing loop
> 	SDL_FillRect(screen, NULL, black);
> 	SDL_UpdateRect(screen, 0, 0, 0, 0);
> 
> if this is normal, then I'll have to use SDL_UpdateRects to speed up
> the drawing, otherwise please tell me what's wrong with my SDL
> configuration.

SDL_UpdateRect(screen, 0, 0, 0, 0); means updateing the whole screen,
you know. if the screen is not doublebuffered and/or not a hwsurface,
this means copying the whole surface each frame. comment it and see
what it does to your framrate.

clemens




More information about the SDL mailing list