]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_screen.c
added vid_stereobuffer cvar based on patch from syschuck on the alientrap forums
[xonotic/darkplaces.git] / cl_screen.c
index 7890134cf48fb3744888938eb8588e58f303dc3e..c01168507eb5803efd58c39a79da772fcd1f58f9 100644 (file)
@@ -994,6 +994,8 @@ Cr = R *  .500 + G * -.419 + B * -.0813 + 128.;
                SCR_CaptureVideo_RIFF_Push("ISFT", NULL);
                SCR_CaptureVideo_RIFF_WriteTerminatedString(engineversion);
                SCR_CaptureVideo_RIFF_Pop();
                SCR_CaptureVideo_RIFF_Push("ISFT", NULL);
                SCR_CaptureVideo_RIFF_WriteTerminatedString(engineversion);
                SCR_CaptureVideo_RIFF_Pop();
+               // enable this junk filler if you like the LIST movi to always begin at 4KB in the file (why?)
+#if 0
                SCR_CaptureVideo_RIFF_Push("JUNK", NULL);
                x = 4096 - SCR_CaptureVideo_RIFF_GetPosition();
                while (x > 0)
                SCR_CaptureVideo_RIFF_Push("JUNK", NULL);
                x = 4096 - SCR_CaptureVideo_RIFF_GetPosition();
                while (x > 0)
@@ -1004,6 +1006,7 @@ Cr = R *  .500 + G * -.419 + B * -.0813 + 128.;
                        x -= i;
                }
                SCR_CaptureVideo_RIFF_Pop();
                        x -= i;
                }
                SCR_CaptureVideo_RIFF_Pop();
+#endif
                SCR_CaptureVideo_RIFF_Pop();
                // begin the actual video section now
                SCR_CaptureVideo_RIFF_Push("LIST", "movi");
                SCR_CaptureVideo_RIFF_Pop();
                // begin the actual video section now
                SCR_CaptureVideo_RIFF_Push("LIST", "movi");
@@ -1639,7 +1642,18 @@ void SCR_UpdateLoadingScreen (void)
        texcoord2f[2] = 1;texcoord2f[3] = 0;
        texcoord2f[4] = 1;texcoord2f[5] = 1;
        texcoord2f[6] = 0;texcoord2f[7] = 1;
        texcoord2f[2] = 1;texcoord2f[3] = 0;
        texcoord2f[4] = 1;texcoord2f[5] = 1;
        texcoord2f[6] = 0;texcoord2f[7] = 1;
-       R_Mesh_Draw(0, 4, 2, polygonelements);
+       if (vid.stereobuffer)
+       {
+               qglDrawBuffer(GL_BACK_LEFT);
+               R_Mesh_Draw(0, 4, 2, polygonelements);
+               qglDrawBuffer(GL_BACK_RIGHT);
+               R_Mesh_Draw(0, 4, 2, polygonelements);
+       }
+       else
+       {
+               qglDrawBuffer(GL_BACK);
+               R_Mesh_Draw(0, 4, 2, polygonelements);
+       }
        R_Mesh_Finish();
        // refresh
        VID_Finish(false);
        R_Mesh_Finish();
        // refresh
        VID_Finish(false);
@@ -1729,7 +1743,7 @@ void CL_UpdateScreen(void)
        if (r_timereport_active)
                R_TimeReport("clear");
 
        if (r_timereport_active)
                R_TimeReport("clear");
 
-       if (r_stereo_redblue.integer || r_stereo_redgreen.integer || r_stereo_redcyan.integer || r_stereo_sidebyside.integer)
+       if (vid.stereobuffer || r_stereo_redblue.integer || r_stereo_redgreen.integer || r_stereo_redcyan.integer || r_stereo_sidebyside.integer)
        {
                matrix4x4_t originalmatrix = r_view.matrix;
                r_view.matrix.m[0][3] = originalmatrix.m[0][3] + r_stereo_separation.value * -0.5f * r_view.matrix.m[0][1];
        {
                matrix4x4_t originalmatrix = r_view.matrix;
                r_view.matrix.m[0][3] = originalmatrix.m[0][3] + r_stereo_separation.value * -0.5f * r_view.matrix.m[0][1];
@@ -1746,6 +1760,9 @@ void CL_UpdateScreen(void)
                        r_view.colormask[2] = 0;
                }
 
                        r_view.colormask[2] = 0;
                }
 
+               if (vid.stereobuffer)
+                       qglDrawBuffer(GL_BACK_RIGHT);
+
                SCR_DrawScreen();
 
                r_view.matrix.m[0][3] = originalmatrix.m[0][3] + r_stereo_separation.value * 0.5f * r_view.matrix.m[0][1];
                SCR_DrawScreen();
 
                r_view.matrix.m[0][3] = originalmatrix.m[0][3] + r_stereo_separation.value * 0.5f * r_view.matrix.m[0][1];
@@ -1762,12 +1779,18 @@ void CL_UpdateScreen(void)
                        r_view.colormask[2] = r_stereo_redcyan.integer || r_stereo_redblue.integer;
                }
 
                        r_view.colormask[2] = r_stereo_redcyan.integer || r_stereo_redblue.integer;
                }
 
+               if (vid.stereobuffer)
+                       qglDrawBuffer(GL_BACK_LEFT);
+
                SCR_DrawScreen();
 
                r_view.matrix = originalmatrix;
        }
        else
                SCR_DrawScreen();
 
                r_view.matrix = originalmatrix;
        }
        else
+       {
+               qglDrawBuffer(GL_BACK);
                SCR_DrawScreen();
                SCR_DrawScreen();
+       }
 
        SCR_CaptureVideo();
 
 
        SCR_CaptureVideo();