OpenGL fullscreen

Hello, I’m working on an OpenGL SDL application that will eventually
work in both fullscreen and windowed mode. I can currently set the
GL attributes, and initialize a fullscreen or windowed surface,
but OpenGL rendering in fullscreen mode takes a lot longer than
in a window, and makes animating even small models look very jerky.

I’m setting a 32bit video mode, with 8 bits for red, green, blue,
and alpha each, a 32bit depth buffer, and doublebuffering.
This is my call to SetVideoMode:

screen = SDL_SetVideoMode(800, 600, 32,
SDL_OPENGL|SDL_DOUBLEBUF|SDL_HWSURFACE|SDL_FULLSCREEN|SDL_ANYFORMAT);

the acquired depth is always 32, and the flags on the surface get
returned as SDL_FULLSCREEN|SDL_HWSURFACE.

Any help would be appreciated.

											Maciej Babinski
											@Maciej_Babinski

Hello, I’m working on an OpenGL SDL application that will eventually
work in both fullscreen and windowed mode. I can currently set the
GL attributes, and initialize a fullscreen or windowed surface,
but OpenGL rendering in fullscreen mode takes a lot longer than
in a window, and makes animating even small models look very jerky.

I’m setting a 32bit video mode, with 8 bits for red, green, blue,
and alpha each, a 32bit depth buffer, and doublebuffering.
This is my call to SetVideoMode:

screen = SDL_SetVideoMode(800, 600, 32,
SDL_OPENGL|SDL_DOUBLEBUF|SDL_HWSURFACE|SDL_FULLSCREEN|SDL_ANYFORMAT);

the acquired depth is always 32, and the flags on the surface get
returned as SDL_FULLSCREEN|SDL_HWSURFACE.

Any help would be appreciated.

Maciej Babinski
maciej at imsa.edu

Maciej,

I used the following logic to set up my OpenGL SDL application that runs both full screen and windowed. This is cut from a routine that gets parameters ‘width’, ‘height’ and ‘fullscreenflag’.

// set the flag that gets passed to SDL requesting
// how we want things configured:
UINT32 flags = SDL_OPENGL | SDL_RESIZABLE;
if (fullscreenflag)
{
flags |= SDL_FULLSCREEN;

// if we're doing full screen, ignore the passed in 
// width & height values and set to the screen dimensions:
width  = gApp->GetCurrentFullScrnXRes();
height = gApp->GetCurrentFullScrnYRes();

}
else
{
gApp->SetCurrentWindowedXRes( width );
gApp->SetCurrentWindowedYRes( height );
}

// passing “bits” as zero requests the same bit depth as the desktop
// (I’ve previously checked to be sure it’s at least 32.)
// This is where the OpenGL Context is created:
if (SDL_SetVideoMode( width, height, 0, flags) == NULL)
{
return FALSE;
}

Note that I use this logic at application startup before the above logic that calls SDL_SetVideoMode():

// use this to give us the bits per pixel of the desktop:
const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo();
gFrameBufferBitsPerPixel = videoInfo->vfmt->BitsPerPixel;
if (gFrameBufferBitsPerPixel < 32)
{
fprintf( stderr, “must have at least a 32 bit desktop!\n” );
return 1;
}

// tell SDL the minimum size we want for these attributes:
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8 );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 32 );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );

Using this logic, I get faster frame rates when full screen than when running windowed. I hope that helps.

-Blake

----- Original Message -----
From: maciej@imsa.edu (Maciej Babinski)
Sent: Friday, July 19, 2002 1:12 PM

Does your 3D adapter support 800x600 32bit GL acceleration? For grins,
try 24 and 16 and see if you notice a difference. I’ve got a GeForce2 MX
400 and tend to work with 16bit though 24bit seems to work fine… One
day I hope to have a G3Ti, but if your app is going to be used by a lot
of regular joes like myself with older 3D cards, you may want to explore
accomodating lower bitdepths for better performance…

Cheers,
Mike

Maciej Babinski wrote:> Hello, I’m working on an OpenGL SDL application that will eventually

work in both fullscreen and windowed mode. I can currently set the
GL attributes, and initialize a fullscreen or windowed surface,
but OpenGL rendering in fullscreen mode takes a lot longer than
in a window, and makes animating even small models look very jerky.

I’m setting a 32bit video mode, with 8 bits for red, green, blue,
and alpha each, a 32bit depth buffer, and doublebuffering.
This is my call to SetVideoMode:

screen = SDL_SetVideoMode(800, 600, 32,
SDL_OPENGL|SDL_DOUBLEBUF|SDL_HWSURFACE|SDL_FULLSCREEN|SDL_ANYFORMAT);

the acquired depth is always 32, and the flags on the surface get
returned as SDL_FULLSCREEN|SDL_HWSURFACE.

Any help would be appreciated.

  										Maciej Babinski
  										maciej at imsa.edu

SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


http://dotfile.net/ - Dedicated to Open Source Software