Fullscreen changing woes

okay, recently on this list it was said that SDL_WM_ToggleFullscreen() is
an X11 only function, and that toggling fullscreen can be done by re-calling
SDL_SetVideoMode(…) again with or without SDL_FULLSCREEN

it occured to me that SDL_WM_ToggleFullscreen() could be implemented like
this on non X11 platforms, but that is beside the point.

the point is that i can’t get it to work. if the first call to
SDL_SetVideoMode() has SDL_FULLSCREEN it works(fullscreen) and
everyone is happy, and the same if the first call is without the
fullscreen flag. that is until i use my own toggle function.
the screen looks the same, but many of my surfaces don’t draw
themselves and it generally looks random. some text i render on the
side of the screen looks like its
there but its not legible. i can’t understand it but i think that its
my mistake as to what i am doing?

this is the correct way to implement this, right???

the Fullscreen mode is only set with 1024x768, 800x600 width && height
and i can get SDL to use these on startup, basically i only encounter
the problem
on a change from fullscreen to non fullscreen.

any suggestions would be helpful

i’m using the prebuilt version of SDL for windows and dev-cpp.

Brian Barrett wrote:

okay, recently on this list it was said that SDL_WM_ToggleFullscreen() is
an X11 only function, and that toggling fullscreen can be done by re-calling
SDL_SetVideoMode(…) again with or without SDL_FULLSCREEN

Do you realize you have to re-blit everything on the screen when you do
this?

it occured to me that SDL_WM_ToggleFullscreen() could be implemented like
this on non X11 platforms, but that is beside the point.

No, that’s actually a FAQ:
http://www.libsdl.org/faq.php?action=listentries&category=4#79

“The semantics of SDL_WM_ToggleFullScreen() are that switching between
fullscreen and windowed mode is transprent to the application. The
display pixels pointer does not change, the display depth does not
change, etc. This cannot be guaranteed on Windows.”

Keep in mind that, when you’re calling SDL_SetVideoMode again, all
previous hardware surfaces (and all OpenGL resources, e.g. textures or
display lists) are lost, and need to be reloaded.

  • Andreas