]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_sdl.c
DP_PRELOAD_DEPENDENCIES=yes makefile option: when set, link against the libraries...
[xonotic/darkplaces.git] / vid_sdl.c
index acd41272a32913c82f653b5efd4d03553f129c22..7ac1e4ec8e367ead582b82a1dcc8c11db14a5c00 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -341,7 +341,7 @@ void Sys_SendKeyEvents( void )
        while( SDL_PollEvent( &event ) )
                switch( event.type ) {
                        case SDL_QUIT:
-                               Sys_Quit();
+                               Sys_Quit(0);
                                break;
                        case SDL_KEYDOWN:
                        case SDL_KEYUP:
@@ -470,9 +470,10 @@ static void VID_OutputVersion()
                                        version->major, version->minor, version->patch );
 }
 
-int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate)
+int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate, int stereobuffer)
 {
        int i;
+       static int notfirstvideomode = false;
        int flags = SDL_OPENGL;
        const char *drivername;
 
@@ -483,7 +484,9 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate
                We cant switch from one OpenGL video mode to another.
                Thus we first switch to some stupid 2D mode and then back to OpenGL.
        */
-       SDL_SetVideoMode( 0, 0, 0, 0 );
+       if (notfirstvideomode)
+               SDL_SetVideoMode( 0, 0, 0, 0 );
+       notfirstvideomode = true;
 
        // SDL usually knows best
        drivername = NULL;
@@ -530,6 +533,8 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate
                SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, 1);
                SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 16);
        }
+       if (stereobuffer)
+               SDL_GL_SetAttribute (SDL_GL_STEREO, 1);
 
        screen = SDL_SetVideoMode(width, height, bpp, flags);
        if (screen == NULL)
@@ -585,6 +590,9 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate
 
 void VID_Shutdown (void)
 {
+       // this is needed to retry gamma after a vid_restart
+       VID_RestoreSystemGamma();
+
        IN_Activate(false);
        SDL_QuitSubSystem(SDL_INIT_VIDEO);
 }