diff libvo/vo_gl.c @ 31567:0ffe9f97fc9f

Add initial stereo support to -vo gl.
author reimar
date Mon, 05 Jul 2010 19:19:56 +0000
parents a12dc8956533
children 0f48a746def1
line wrap: on
line diff
--- a/libvo/vo_gl.c	Mon Jul 05 18:24:02 2010 +0000
+++ b/libvo/vo_gl.c	Mon Jul 05 19:19:56 2010 +0000
@@ -155,6 +155,7 @@
 static int custom_tlin;
 static int custom_trect;
 static int mipmap_gen;
+static int stereo_mode;
 
 static int int_pause;
 static int eq_bri = 0;
@@ -788,11 +789,27 @@
   mpglColor3f(1,1,1);
   if (is_yuv || custom_prog)
     glEnableYUVConversion(gl_target, yuvconvtype);
+  if (stereo_mode) {
+    glEnable3DLeft(stereo_mode);
+    glDrawTex(0, 0, image_width, image_height,
+              0, 0, image_width >> 1, image_height,
+              texture_width, texture_height,
+              use_rectangle == 1, is_yuv,
+              mpi_flipped ^ vo_flipped);
+    glEnable3DRight(stereo_mode);
+    glDrawTex(0, 0, image_width, image_height,
+              image_width >> 1, 0, image_width >> 1, image_height,
+              texture_width, texture_height,
+              use_rectangle == 1, is_yuv,
+              mpi_flipped ^ vo_flipped);
+    glDisable3D(stereo_mode);
+  } else {
   glDrawTex(0, 0, image_width, image_height,
             0, 0, image_width, image_height,
             texture_width, texture_height,
             use_rectangle == 1, is_yuv,
             mpi_flipped ^ vo_flipped);
+  }
   if (is_yuv || custom_prog)
     glDisableYUVConversion(gl_target, yuvconvtype);
 }
@@ -1098,6 +1115,7 @@
   {"customtrect",  OPT_ARG_BOOL, &custom_trect, NULL},
   {"mipmapgen",    OPT_ARG_BOOL, &mipmap_gen,   NULL},
   {"osdcolor",     OPT_ARG_INT,  &osd_color,    NULL},
+  {"stereo",       OPT_ARG_INT,  &stereo_mode,  NULL},
   {NULL}
 };
 
@@ -1129,6 +1147,7 @@
     custom_trect = 0;
     mipmap_gen = 0;
     osd_color = 0xffffff;
+    stereo_mode = 0;
     if (subopt_parse(arg, subopts) != 0) {
       mp_msg(MSGT_VO, MSGL_FATAL,
               "\n-vo gl command line help:\n"
@@ -1202,6 +1221,11 @@
               "    generate mipmaps for the video image (use with TXB in customprog)\n"
               "  osdcolor=<0xAARRGGBB>\n"
               "    use the given color for the OSD\n"
+              "  stereo=<n>\n"
+              "    0: normal display\n"
+              "    1: side-by-side to red-cyan stereo\n"
+              "    2: side-by-side to green-magenta stereo\n"
+              "    3: side-by-side to quadbuffer stereo (broken?)\n"
               "\n" );
       return -1;
     }