From 395c9bc638e8c83fcf00974023e976a03e84f951 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 6 Apr 2004 14:28:22 +0000 Subject: [PATCH] API changes to get fullscreen mode working with SDL. It can't switch modes after creating the window, so it needs a flag in fgOSOpenWindow(). --- src/Main/fg_os.cxx | 3 ++- src/Main/fg_os.hxx | 3 ++- src/Main/fg_os_sdl.cxx | 10 ++++++++-- src/Main/main.cxx | 3 ++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Main/fg_os.cxx b/src/Main/fg_os.cxx index 81ddf0b55..e7a86d81f 100644 --- a/src/Main/fg_os.cxx +++ b/src/Main/fg_os.cxx @@ -177,7 +177,8 @@ void fgRequestRedraw() glutPostRedisplay(); } -void fgOSOpenWindow(int w, int h, int bpp, bool alpha, bool stencil) +void fgOSOpenWindow(int w, int h, int bpp, bool alpha, + bool stencil, bool fullscreen) { int mode = GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE; if(alpha) mode |= GLUT_ALPHA; diff --git a/src/Main/fg_os.hxx b/src/Main/fg_os.hxx index 8d05d49cc..14f939795 100644 --- a/src/Main/fg_os.hxx +++ b/src/Main/fg_os.hxx @@ -38,7 +38,8 @@ enum { KEYMOD_NONE = 0, // void fgOSInit(int* argc, char** argv); -void fgOSOpenWindow(int w, int h, int bpp, bool alpha, bool stencil); +void fgOSOpenWindow(int w, int h, int bpp, bool alpha, bool stencil, + bool fullscreen); void fgOSFullScreen(); void fgOSMainLoop(); diff --git a/src/Main/fg_os_sdl.cxx b/src/Main/fg_os_sdl.cxx index 8813cad78..9027ef428 100644 --- a/src/Main/fg_os_sdl.cxx +++ b/src/Main/fg_os_sdl.cxx @@ -57,7 +57,8 @@ void fgRegisterMouseMotionHandler(fgMouseMotionHandler func) // static void initCursors(); -void fgOSOpenWindow(int w, int h, int bpp, bool alpha, bool fullscreen) +void fgOSOpenWindow(int w, int h, int bpp, + bool alpha, bool stencil, bool fullscreen) { int cbits = (bpp <= 16) ? 5 : 8; int zbits = (bpp <= 16) ? 16 : 32; @@ -69,11 +70,16 @@ void fgOSOpenWindow(int w, int h, int bpp, bool alpha, bool fullscreen) SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, cbits); if(alpha) SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); + if(stencil) + SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, zbits); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); int vidmask = SDL_OPENGL; - if(fullscreen) vidmask |= SDL_FULLSCREEN; + if(fullscreen) { + __builtin_printf("FULLSCREEN!\n"); + vidmask |= SDL_FULLSCREEN; + } SDL_SetVideoMode(w, h, 16, vidmask); // FIXME: handle errors SDL_WM_SetCaption("FlightGear", "FlightGear"); diff --git a/src/Main/main.cxx b/src/Main/main.cxx index bf586ccf6..bedd2f3e1 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -1534,7 +1534,8 @@ bool fgMainInit( int argc, char **argv ) { fgGetInt("/sim/startup/ysize"), fgGetInt("/sim/rendering/bits-per-pixel"), fgGetBool("/sim/rendering/clouds3d"), - get_stencil_buffer ); + get_stencil_buffer, + fgGetBool("/sim/startup/fullscreen") ); // This seems to be the absolute earliest in the init sequence // that these calls will return valid info. Too bad it's after