Fullscreen with SDL

Started by
2 comments, last by RizMan 21 years, 1 month ago
I am having trouble bringing my OpenGL application to fullscreen using SDL. When hitting the F1 key, SDL_WM_ToggleFullScreen is called. However, it won''t change to fullscreen.
  
void ToggleFullScreen(void)
{
    if(SDL_WM_ToggleFullScreen(MainWindow) == 0)           
    {
        cerr << "Failed to Toggle Fullscreen mode : " << SDL_GetError() << endl;   
		printf("error");
        Quit(0);
    }
}
  
That''s what I''m doint. I indeed get the error message, so SDL can''t change to fullscreen. I am using Win32. I read somewhere that this only works on X11 but somehow coudln''t believe it. Anyone knows if that''s true and if yes: Can I at least use GLUT to change to Fullscreen?
Advertisement
According to the SDL docs SDL_WM_ToggleFullScreen is only available under X11.
You can try using SDL_SetVideoMode, as suggested by tamatito in the doc page, instead to recreate your main window surface using the appropriate flag (SDL_FULLSCREEN).

[edited by - baumep on March 2, 2003 6:02:33 PM]
baumep
In fact, I highly suggest you do NOT use that function. Even under X11, it has problems. I found that it was MUCH easier to simply write my own that did a brand new SetVideoMode.

(oh, and the problem i was having was that I only had a few video modes to work with and when using that function, it switched to the next-highest mode and displayed itself in a box in the middle of the screen. I was using openGL, so I didn''t care about resolution. I enumerated available modes and resized to the bigger size myself. tadaa! no more window in the middle surrounded by black, a nice fullscreen instead.)
Ok thank you guys. I will change the code to change to VideoFlags of SDL_SetVideoMode.

This topic is closed to new replies.

Advertisement