[SDL] SDL_Flip causes a HUGE loss of fps!

Derethor derethor at thepentagon.com
Fri Jan 5 01:50:13 PST 2001


 hI everybody!

 When I update the screen in fullscreen mode, I have a quite normal loop
like this:

		surface = SDL_GetVideoSurface ();

		if (!surface) return;

		if ( DK_SURFACE_IS_OPENGL (surface) )
		{
			draw stuff...
			SDL_GL_SwapBuffers ();
		}
		else
		{
			draw stuff...
			SDL_Flip (surface);
		}

 Let's talk about the non-opengl surface...

 without the SDL_Flip (surface); I have ~33500 fps doing nothing else
but waiting a key (640x480 32bpp, Athlon 650 under linux)

 with that call, the frame rate goes down to ~118 fps !!

 is this normal?

 FYI, I create the surface with this code

	sdl_flags |= SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_FULLSCREEN;

	if ( SDL_VideoModeOK (surface_old->w, surface_old->h, 32, sdl_flags) )
	{
		fullscreen = SDL_SetVideoMode ( surface_old->w, surface_old->h, 32,
sdl_flags);
		if (!fullscreen)
		{
			DK_ERROR ("Unable to set the fullscreen: %s", SDL_GetError() );
			return (FALSE);
		}
	}
	else
	{
		DK_ERROR ("requested fullscreen video mode is not supported");
		return (FALSE);
	}

 but at this point, neither SDL_HWSURFACE and SDL_DOUBLEBUF are active
on the fullscreen surface :?

 I get the videomodes like this:

 modes = SDL_ListModes (NULL, SDL_FULLSCREEN | SDL_HWSURFACE |
SDL_OPENGLBLIT );

 any suggestion?

 thanks ins advance!

-- 
signed
          derethor of centolos





More information about the SDL mailing list