Hi,
I’m making a game using SDL with OpenGL and i want to change the video mode
at runtime. So i use SDL_SetVideoMode, but i’ve met bugs with my radeon 7200:
- If i switch from 32bpp windowed to 16bpp fullscreen my video driver
always crashes. Well maybe it’s not because of SDL after all - If i switch from 16bpp fullscreen to 32bpp windowed i get a new window
(sometimes i need to make it appear by iconifying/restoring it) but it
doesn’t receive any keyboard events anymore (SDL_GetKeyState doesn’t work
either, but ActiveEvents still work for example). This must be because of SDL. - If i toggle double buffering i get the same problem: no keyboard input
anymore.
I can avoid all those bugs if i don’t use double buffering, but it’s too ugly.
If you want to test that bug just add a SDL_SetVideoMode in testgl.c so
that you first use a single buffer and then you use double buffering
(copy/paste and replace a 1 with a 0). Should be like:
—8<------------8<------------8<------------8<------------8<------------8<----
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, rgb_size[0] );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, rgb_size[1] );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, rgb_size[2] );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 0 );
if ( fsaa ) {
SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 );
SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, fsaa );
}
if ( SDL_SetVideoMode( w, h, bpp, video_flags ) == NULL ) {
fprintf(stderr, “Couldn’t set GL mode: %s\n”, SDL_GetError());
SDL_Quit();
exit(1);
}
SDL_GL_SetAttribute( SDL_GL_RED_SIZE, rgb_size[0] );
SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, rgb_size[1] );
SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, rgb_size[2] );
SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
if ( fsaa ) {
SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 );
SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, fsaa );
}
if ( SDL_SetVideoMode( w, h, bpp, video_flags ) == NULL ) {
fprintf(stderr, “Couldn’t set GL mode: %s\n”, SDL_GetError());
SDL_Quit();
exit(1);
}
—8<------------8<------------8<------------8<------------8<------------8<----
The result is that if you press Esc for example nothing happens. Well at
least on my computer.
I think the problem might be when SDL needs to reset something, like making
a new window or something, which should be rare, i guess.
Thanks in advance for any help.–
Hibernatus