set vid_stereobuffer cvar based on whether GL_STEREO is true after setting the mode
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 17 Apr 2013 07:13:52 +0000 (07:13 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 17 Apr 2013 07:13:52 +0000 (07:13 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11943 d7cf8633-e32d-0410-b094-e92efae38249

glquake.h
vid_shared.c

index 1802909..f925b83 100644 (file)
--- a/glquake.h
+++ b/glquake.h
@@ -99,6 +99,8 @@ typedef ptrdiff_t GLintptrARB;
 // int whose size is the same as a pointer (?)
 typedef ptrdiff_t GLsizeiptrARB;
 
+#define GL_STEREO                                      0x0C33
+
 #define GL_MODELVIEW                           0x1700
 #define GL_PROJECTION                          0x1701
 #define GL_TEXTURE                             0x1702
index 4cac85d..b141908 100644 (file)
@@ -1840,6 +1840,22 @@ static int VID_Mode(int fullscreen, int width, int height, int bpp, float refres
                vid.sRGB2D         = vid_sRGB.integer >= 1 && vid.sRGBcapable2D;
                vid.sRGB3D         = vid_sRGB.integer >= 1 && vid.sRGBcapable3D;
 
+               switch(vid.renderpath)
+               {
+               case RENDERPATH_GL11:
+               case RENDERPATH_GL13:
+               case RENDERPATH_GL20:
+                       {
+                               GLboolean stereo;
+                               qglGetBooleanv(GL_STEREO, &stereo);
+                               vid.stereobuffer = stereo != 0;
+                       }
+                       break;
+               default:
+                       vid.stereobuffer = false;
+                       break;
+               }
+
                if(
                        (vid_sRGB_fallback.integer >= 3) // force fallback
                        ||
@@ -1860,7 +1876,7 @@ static int VID_Mode(int fullscreen, int width, int height, int bpp, float refres
                Cvar_SetValueQuick(&vid_samples, vid.mode.samples);
                if(vid_userefreshrate.integer)
                        Cvar_SetValueQuick(&vid_refreshrate, vid.mode.refreshrate);
-               Cvar_SetValueQuick(&vid_stereobuffer, vid.mode.stereobuffer);
+               Cvar_SetValueQuick(&vid_stereobuffer, vid.stereobuffer ? 1 : 0);
 
                return true;
        }