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().
This commit is contained in:
parent
34b0b5220c
commit
395c9bc638
4 changed files with 14 additions and 5 deletions
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue