Active (quadbuffer) stereo mode

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

Active (quadbuffer) stereo mode

Postby syschuck » Sun Sep 24, 2006 7:39 pm

Hi All,

I was looking through the Nexuis code and saw that the engine has a
lot of options for stereo viewing (red/blue, side-by-side) but no
active (quadbuffer) stereo for LCD shutter glasses and the like.
These patches add that capability. It work very well on my
QuadroFX card giving crystal clear eye poping 3D.

The modifications are pretty small thanks to all the previous stereo work.
It's controlled by two new command line options;

nexuis-glx -stereogl +r_stereo_active 1
or
nexuis-sdl -stereogl -r_stereo_active 1


Nice game engine. Have Fun.
Chuck Sites

vid_glx.c
Code: Select all
--- darkplaces/vid_glx.c        2006-08-31 10:16:54.000000000 -0400
+++ darkplaces_stereo/vid_glx.c 2006-09-24 12:53:17.717450740 -0400
@@ -87,6 +87,7 @@
static qboolean vid_usingmouse = false;
static qboolean vid_usingvsync = false;
static qboolean vid_usevsync = false;
+static qboolean vid_stereogl = false;
static qboolean vid_x11_hardwaregammasupported = false;
static int vid_x11_gammarampsize = 0;
static float   mouse_x, mouse_y;
@@ -610,6 +611,8 @@
// COMMANDLINEOPTION: Input: -nomouse disables mouse support (see also vid_mouse cvar)
        if (COM_CheckParm ("-nomouse") || COM_CheckParm("-safe"))
                mouse_avail = false;
+       if (COM_CheckParm ("-stereogl"))
+               vid_stereogl = true;
}

void VID_BuildGLXAttrib(int *attrib, int stencil)
@@ -620,6 +623,11 @@
        *attrib++ = GLX_BLUE_SIZE;*attrib++ = 1;
        *attrib++ = GLX_DOUBLEBUFFER;
        *attrib++ = GLX_DEPTH_SIZE;*attrib++ = 1;
+       if (vid_stereogl) {
+               // Humm why the *attrib++ = 1; above?
+               *attrib++ = GLX_STEREO;
+       }
+
        // if stencil is enabled, ask for alpha too
        if (stencil)
        {


vid_sdl.c
Code: Select all
--- darkplaces/vid_sdl.c        2006-08-31 10:16:54.000000000 -0400
+++ darkplaces_stereo/vid_sdl.c 2006-09-24 12:49:23.807755679 -0400
@@ -52,6 +52,7 @@

static qboolean vid_usingmouse;
static qboolean vid_isfullscreen;
+static qboolean vid_stereogl=false;
static int vid_numjoysticks = 0;
#define MAX_JOYSTICKS 8
static SDL_Joystick *vid_joysticks[MAX_JOYSTICKS];
@@ -530,6 +531,9 @@
                SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, 1);
                SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 16);
        }
+       if (COM_CheckParm("-stereogl"))
+               SDL_GL_SetAttribute (SDL_GL_STEREO, 1);
+

        screen = SDL_SetVideoMode(width, height, bpp, flags);
        if (screen == NULL)


glquake.h
Code: Select all
--- darkplaces/glquake.h        2006-08-10 16:33:44.000000000 -0400
+++ darkplaces_stereo/glquake.h 2006-09-24 12:59:24.064576006 -0400
@@ -170,8 +170,14 @@
#define GL_TEXTURE_COORD_ARRAY                 0x8078
//#define GL_EDGE_FLAG_ARRAY                   0x8079

+#define GL_FRONT_LEFT                           0x0400
+#define GL_FRONT_RIGHT                          0x0401
+#define GL_BACK_LEFT                            0x0402
+#define GL_BACK_RIGHT                           0x0403
#define GL_FRONT                               0x0404
#define GL_BACK                                        0x0405
+#define GL_LEFT                                 0x0406
+#define GL_RIGHT                                0x0407

#define GL_VENDOR                              0x1F00
#define GL_RENDERER                            0x1F01


cl_screen.c
Code: Select all
--- darkplaces/cl_screen.c      2006-09-05 21:23:50.000000000 -0400
+++ darkplaces_stereo/cl_screen.c       2006-09-24 14:23:27.386635358 -0400
@@ -37,6 +37,7 @@
cvar_t r_stereo_redblue = {0, "r_stereo_redblue", "0", "red/blue anaglyph stereo glasses (note: most of these glasses are actually red/cyan, try that one too)"};
cvar_t r_stereo_redcyan = {0, "r_stereo_redcyan", "0", "red/cyan anaglyph stereo glasses, the kind given away at drive-in movies like Creature From The Black Lagoon In 3D"};
cvar_t r_stereo_redgreen = {0, "r_stereo_redgreen", "0", "red/green anaglyph stereo glasses (for those who don't mind yellow)"};
+cvar_t r_stereo_active = {0, "r_stereo_active", "0", "Active stereo (for lcd-shutter glasses and quadro cards)"};
cvar_t scr_zoomwindow = {CVAR_SAVE, "scr_zoomwindow", "0", "displays a zoomed in overlay window"};
cvar_t scr_zoomwindow_viewsizex = {CVAR_SAVE, "scr_zoomwindow_viewsizex", "20", "horizontal viewsize of zoom window"};
cvar_t scr_zoomwindow_viewsizey = {CVAR_SAVE, "scr_zoomwindow_viewsizey", "20", "vertical viewsize of zoom window"};
@@ -607,6 +608,7 @@
        Cvar_RegisterVariable(&r_stereo_redblue);
        Cvar_RegisterVariable(&r_stereo_redcyan);
        Cvar_RegisterVariable(&r_stereo_redgreen);
+       Cvar_RegisterVariable(&r_stereo_active);
        Cvar_RegisterVariable(&scr_zoomwindow);
        Cvar_RegisterVariable(&scr_zoomwindow_viewsizex);
        Cvar_RegisterVariable(&scr_zoomwindow_viewsizey);
@@ -1493,7 +1495,7 @@
        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 (r_stereo_active.integer || 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];
@@ -1510,6 +1512,9 @@
                        r_view.colormask[2] = 0;
                }

+               if (r_stereo_active.integer)
+                        qglDrawBuffer(GL_BACK_LEFT);
+
                SCR_DrawScreen();

                r_view.matrix.m[0][3] = originalmatrix.m[0][3] + r_stereo_separation.value * 0.5f * r_view.matrix.m[0][1];
@@ -1526,6 +1531,9 @@
                        r_view.colormask[2] = r_stereo_redcyan.integer || r_stereo_redblue.integer;
                }

+               if (r_stereo_active.integer)
+                        qglDrawBuffer(GL_BACK_RIGHT);
+
                SCR_DrawScreen();

                r_view.matrix = originalmatrix;
syschuck
Newbie
 
Posts: 8
Joined: Sun Sep 24, 2006 6:32 pm

Postby tChr » Sun Sep 24, 2006 8:08 pm

This have to be the coolest first post ever :)
the spice extend life!
the spice expand conciousness!
the spice is vital to space travel!
sooooo.. tell me what you want, waht you really-really want
I will proceed directly to the intravenous injection of hard drugs, please.
tChr
Forum addon
 
Posts: 1501
Joined: Tue Feb 28, 2006 9:11 pm
Location: Trondheim, Norway

Postby kyre » Sun Sep 24, 2006 9:34 pm

It's a bit late for 3d maths for me ATM, but this code is using the toe-in method rather than off-axis projection, right? If so, good thing i'm going cross-eyed from fatigue... ;-)

Nice first post, BTW. =-)
Whenever You go, then You aren't.
kyre
Alien
 
Posts: 118
Joined: Tue Jun 13, 2006 8:56 pm
Location: Sweden

Postby syschuck » Sun Sep 24, 2006 10:12 pm

Hi. Thanks for encouragement. I just wanted to pass on two more patches
for the Apple and Windows users that want active stereo. I don't have ether
of those systems, so these are completely untested. According to what
I've read these should work. Perhaps someone could test these. Also
I've read in some old posts that AGL does not support
glDrawBuffer(GL_BACK_LEFT); or glDrawBuffer(GL_BACK_RIGHT);
commands. So I wouldn't be supprized if active stereo on Apples is broke.

Also, I may have the Left and Right buffers reversed in cl_screen.c as I seem to
be seeing really good depth with the r_stereo_separation -4. Just swap
the LEFT and RIGHT in the cl_screen.c patch.

The only other problem I see is the floating gun. It's so close to the user that
it's hard to make the left and right images converge and it becomes very
distracting. Perhaps someone else may have a fix for that like a special
transformation for gun when viewed in stereo.

Have Fun,
Chuck

Code: Select all
--- darkplaces/vid_wgl.c        2006-08-31 10:16:54.000000000 -0400
+++ darkplaces_stereo/vid_wgl.c 2006-09-24 17:17:03.038885785 -0400
@@ -776,6 +776,10 @@
                pfd.cAlphaBits = 0;
        }

+       if (COM_CheckParm("-stereogl))
+                pfd.dwFlags =  PFD_DRAW_TO_WINDOW |  PFD_SUPPORT_OPENGL  |  PFD_DOUBLEBUFFER | PFD_STEREO;
+
+
        gldrivername = "opengl32.dll";
// COMMANDLINEOPTION: Windows WGL: -gl_driver <drivername> selects a GL driver library, default is opengl32.dll, useful only for 3dfxogl.dll or 3dfxvgl.dll, if you don't know what this is for, you don't need it
        i = COM_CheckParm("-gl_driver");


vid_agl.c
Code: Select all
--- darkplaces/vid_agl.c        2006-08-31 10:16:54.000000000 -0400
+++ darkplaces_stereo/vid_agl.c 2006-09-24 17:20:58.883645595 -0400
@@ -52,6 +52,7 @@

static qboolean vid_isfullscreen = false;
static qboolean vid_usingvsync = false;
+static qboolean vid_stereogl = false;

static qboolean sound_active = true;

@@ -231,6 +232,8 @@
// COMMANDLINEOPTION: Input: -nomouse disables mouse support (see also vid_mouse cvar)
        if (COM_CheckParm ("-nomouse") || COM_CheckParm("-safe"))
                mouse_avail = false;
+       if (COM_CheckParm ("-stereogl"))
+               vid_stereogl = true;
}

static void *prjobj = NULL;
@@ -369,6 +372,11 @@
        *attrib++ = AGL_DOUBLEBUFFER;
        *attrib++ = AGL_DEPTH_SIZE;*attrib++ = 1;

+       if (vid_stereogl) {
+               // Humm why the *attrib++ = 1; above?
+               *attrib++ = AGL_STEREO;
+       }
+
        // if stencil is enabled, ask for alpha too
        if (stencil)
        {
syschuck
Newbie
 
Posts: 8
Joined: Sun Sep 24, 2006 6:32 pm

Postby syschuck » Sun Sep 24, 2006 10:28 pm

Opps. the patch for vid_wgl.c has a typo. Here is that patch corrected.

Have Fun,
Chuck

vid_wgl.c
Code: Select all
--- darkplaces/vid_wgl.c        2006-08-31 10:16:54.000000000 -0400
+++ darkplaces_stereo/vid_wgl.c 2006-09-24 18:24:12.853721979 -0400
@@ -776,6 +776,10 @@
                pfd.cAlphaBits = 0;
        }

+       if (COM_CheckParm("-stereogl"))
+                pfd.dwFlags =  PFD_DRAW_TO_WINDOW |  PFD_SUPPORT_OPENGL  |  PFD_DOUBLEBUFFER | PFD_STEREO;
+
+
        gldrivername = "opengl32.dll";
// COMMANDLINEOPTION: Windows WGL: -gl_driver <drivername> selects a GL driver library, default is opengl32.dll, usefu
l only for 3dfxogl.dll or 3dfxvgl.dll, if you don't know what this is for, you don't need it
        i = COM_CheckParm("-gl_driver");
syschuck
Newbie
 
Posts: 8
Joined: Sun Sep 24, 2006 6:32 pm

Postby kyre » Mon Sep 25, 2006 6:41 pm

I think your problem with the gun rendering is a symptom of the code using toe-in as the projection method, as this means the near/far planes of the left/right views aren't projected onto the same planes. To do so, you need to set up asymmetric view frustums in addition to simply moving the eye point. Have a look at http://local.wasp.uwa.edu.au/~pbourke/stereographics/stereorender/ for a better explanation than mine. =-)

The *attrib++ = 1; is because nnn_DEPTH_SIZE uses the following attribute as a value specifying how many depth bits of precision to require as a minimum. 1 by convention usually means "I need this buffer but don't care what precision it has".

I'll see if I can't sneek in some time at work to try this patch out. :-)
Whenever You go, then You aren't.
kyre
Alien
 
Posts: 118
Joined: Tue Jun 13, 2006 8:56 pm
Location: Sweden

Re: Active (quadbuffer) stereo mode

Postby LordHavoc » Mon Oct 02, 2006 4:27 pm

syschuck wrote:Hi All,

I was looking through the Nexuis code and saw that the engine has a
lot of options for stereo viewing (red/blue, side-by-side) but no
active (quadbuffer) stereo for LCD shutter glasses and the like.
These patches add that capability. It work very well on my
QuadroFX card giving crystal clear eye poping 3D.

The modifications are pretty small thanks to all the previous stereo work.
It's controlled by two new command line options;

nexuis-glx -stereogl +r_stereo_active 1
or
nexuis-sdl -stereogl -r_stereo_active 1


Nice game engine. Have Fun.
Chuck Sites


This patch is interesting, though I think it may need some more refinement before inclusion.

Could you please change it from using a -stereogl commandline option to a vid_stereo cvar (this can still be set on the commandline using +vid_stereo 1) which is saved to the config and available in the video options menu. This way it can easily default off but be available to people who think their hardware supports it :)

Additionally that cvar could directly control the stereo rendering, since usually if someone turns that on they want stereo rendering, the other r_stereo_* cvars would only be relevant when not using a stereo buffered visual. Although the r_stereo_separation cvar is clearly relevant here, and should be put in the video options menu accordingly.

Regarding the weapon, I'm sorry about that, I keep shrinking the gun more and more due to complaints from people about it poking into walls, it is about 1/9th its actual size in Nexuiz, and consequently VERY distracting, it also doesn't light properly as a result. In DarkPlaces running Quake it is 1/3rd its actual size and I'd like to fix that as well, I just need to find another solution somehow...
LordHavoc
Site Admin
 
Posts: 191
Joined: Wed Mar 29, 2006 7:39 am
Location: western Oregon, USA

Postby syschuck » Mon Oct 16, 2006 6:48 am

Hi All,

LordHavoc, I've modified the patches so that there is now a
vid_stereogl cvar and I also left in the -stereogl command line
option as a convenience; when you see the code, I think you will
agree. I've also left in the r_stereo_active cvar for a couple
of reasons; but mainly so that a user at the console could turn
off stereo rendering and then re-enable it later; say for example
debugging purposes without re-initializing the video hardware,
or perhaps a user just gets tied eyes from stereo but doesn't
want to give up the game. The other reason is so the code doesn't
have to use an extern to peek into the cvars of the 'vid_' section
from the 'cl_' section of the code. I'm just trying to follow the
code style there and keep the changes small. Currently that leaves
the openGL's double buffering in a mess but I think a small change
to the console code will fix that.

Regarding the gun positioning, I can't find where the gun
coordinates are located. Are they in the model itself?
I don't think it's toe-in like kyre suggested (good URL kyre)
Everything else seems to have very good depth qualities even
close up.

About the code; modified are cl_screen.c vid_shared.c and vid_glx.c
vid_sdl.c vid_wgl.c and vid_agl.c. cl_screen.c contains all of the
quad-buffer stereo code. All of the vid_ codes are just initializing
openGL to support quad-buffering. All patches are generated with
diff -u original new

Anyway, I've been fragging away in eye popping 3D stereo for a weeks
now, and it's a blast! Usually me getting blasted! :-) I'm such a novice.

Best Regards,
Chuck

Code: Select all
--- darkplaces/cl_screen.c      2006-09-05 21:23:50.000000000 -0400
+++ darkplaces_stereo/cl_screen.c       2006-10-15 22:45:08.545923182 -0400
@@ -37,6 +37,7 @@
cvar_t r_stereo_redblue = {0, "r_stereo_redblue", "0", "red/blue anaglyph stereo glasses (note: most of these glasses are actually red/cyan, try that one too)"};
cvar_t r_stereo_redcyan = {0, "r_stereo_redcyan", "0", "red/cyan anaglyph stereo glasses, the kind given away at drive-in movies like Creature From The Black Lagoon In 3D"};
cvar_t r_stereo_redgreen = {0, "r_stereo_redgreen", "0", "red/green anaglyph stereo glasses (for those who don't mind yellow)"};
+cvar_t r_stereo_active = {0, "r_stereo_active", "0", "Active stereo (for lcd-shutter glasses and quadro cards)"};
cvar_t scr_zoomwindow = {CVAR_SAVE, "scr_zoomwindow", "0", "displays a zoomed in overlay window"};
cvar_t scr_zoomwindow_viewsizex = {CVAR_SAVE, "scr_zoomwindow_viewsizex", "20", "horizontal viewsize of zoom window"};
cvar_t scr_zoomwindow_viewsizey = {CVAR_SAVE, "scr_zoomwindow_viewsizey", "20", "vertical viewsize of zoom window"};
@@ -46,7 +47,6 @@
int jpeg_supported = false;

qboolean       scr_initialized;                // ready to draw
-
float          scr_con_current;

extern int     con_vislines;
@@ -607,6 +607,7 @@
        Cvar_RegisterVariable(&r_stereo_redblue);
        Cvar_RegisterVariable(&r_stereo_redcyan);
        Cvar_RegisterVariable(&r_stereo_redgreen);
+       Cvar_RegisterVariable(&r_stereo_active);
        Cvar_RegisterVariable(&scr_zoomwindow);
        Cvar_RegisterVariable(&scr_zoomwindow_viewsizex);
        Cvar_RegisterVariable(&scr_zoomwindow_viewsizey);
@@ -1493,7 +1494,7 @@
        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 (r_stereo_active.integer || 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];
@@ -1510,6 +1511,9 @@
                        r_view.colormask[2] = 0;
                }

+               if (r_stereo_active.integer)
+                        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];
@@ -1526,6 +1530,9 @@
                        r_view.colormask[2] = r_stereo_redcyan.integer || r_stereo_redblue.integer;
                }

+               if (r_stereo_active.integer)
+                        qglDrawBuffer(GL_BACK_LEFT);
+
                SCR_DrawScreen();

                r_view.matrix = originalmatrix;

vid_shared.c
Code: Select all
--- darkplaces/vid_shared.c     2006-09-04 19:58:08.000000000 -0400
+++ darkplaces_stereo/vid_shared.c      2006-10-15 23:48:17.448328112 -0400
@@ -76,6 +76,7 @@
cvar_t vid_mouse = {CVAR_SAVE, "vid_mouse", "1", "whether to use the mouse in windowed mode (fullscreen always does)"};
cvar_t vid_minwidth = {0, "vid_minwidth", "0", "minimum vid_width that is acceptable (to be set in default.cfg in mods)"};
cvar_t vid_minheight = {0, "vid_minheight", "0", "minimum vid_height that is acceptable (to be set in default.cfg in mods)"};
+cvar_t vid_stereogl = {CVAR_SAVE, "vid_stereogl", "0", "enable active stereo rendering (1) or not (0) enable r_stereo_active also if you want this option"};
cvar_t gl_combine = {0, "gl_combine", "1", "faster rendering by using GL_ARB_texture_env_combine extension (part of OpenGL 1.3 and above)"};
cvar_t gl_finish = {0, "gl_finish", "0", "make the cpu wait for the graphics processor at the end of each rendered frame (can help with strange input or video lag problems on some machines)"};

@@ -889,6 +890,7 @@
        Cvar_RegisterVariable(&vid_mouse);
        Cvar_RegisterVariable(&vid_minwidth);
        Cvar_RegisterVariable(&vid_minheight);
+       Cvar_RegisterVariable(&vid_stereogl);
        Cvar_RegisterVariable(&gl_combine);
        Cvar_RegisterVariable(&gl_finish);
        Cmd_AddCommand("force_centerview", Force_CenterView_f, "recenters view (stops looking up/down)");
@@ -985,6 +987,10 @@
// COMMANDLINEOPTION: Video: -bpp <bits> performs +vid_bitsperpixel <bits> (example -bpp 32 or -bpp 16)
                if ((i = COM_CheckParm("-bpp")) != 0)
                        Cvar_SetQuick(&vid_bitsperpixel, com_argv[i+1]);
+// COMMANDLINEOPTION: Video: -stereogl performs +vid_stereogl 1
+               if (COM_CheckParm("-stereogl"))
+                       Cvar_SetValueQuick(&vid_stereogl, true);
+               // add r_stereo_active too?
        }

        Con_Print("Starting video system\n");

vid_agl.c
Code: Select all
--- darkplaces/vid_agl.c        2006-08-31 10:16:54.000000000 -0400
+++ darkplaces_stereo/vid_agl.c 2006-10-16 02:31:30.074169150 -0400
@@ -369,6 +369,9 @@
        *attrib++ = AGL_DOUBLEBUFFER;
        *attrib++ = AGL_DEPTH_SIZE;*attrib++ = 1;

+        if (Cvar_VariableValue("vid_stereogl"))
+               *attrib++ = AGL_STEREO;
+
        // if stencil is enabled, ask for alpha too
        if (stencil)
        {

vid_glx.c
Code: Select all
--- darkplaces/vid_glx.c        2006-08-31 10:16:54.000000000 -0400
+++ darkplaces_stereo/vid_glx.c 2006-10-16 00:20:40.444854365 -0400
@@ -620,6 +620,10 @@
        *attrib++ = GLX_BLUE_SIZE;*attrib++ = 1;
        *attrib++ = GLX_DOUBLEBUFFER;
        *attrib++ = GLX_DEPTH_SIZE;*attrib++ = 1;
+
+       if (Cvar_VariableValue("vid_stereogl"))
+               *attrib++ = GLX_STEREO;
+
        // if stencil is enabled, ask for alpha too
        if (stencil)
        {

vid_sdl.c
Code: Select all
--- darkplaces/vid_sdl.c        2006-08-31 10:16:54.000000000 -0400
+++ darkplaces_stereo/vid_sdl.c 2006-10-15 23:58:13.202104672 -0400
@@ -530,6 +530,8 @@
                SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, 1);
                SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 16);
        }
+       if (Cvar_VariableValue("vid_stereogl"))
+               SDL_GL_SetAttribute (SDL_GL_STEREO, 1);

        screen = SDL_SetVideoMode(width, height, bpp, flags);
        if (screen == NULL)

vid_wgl.c
Code: Select all
--- darkplaces/vid_wgl.c        2006-08-31 10:16:54.000000000 -0400
+++ darkplaces_stereo/vid_wgl.c 2006-10-15 23:45:01.507098935 -0400
@@ -776,6 +776,9 @@
                pfd.cAlphaBits = 0;
        }

+       if (Cvar_VariableValue("vid_stereogl"))
+                pfd.dwFlags =  PFD_DRAW_TO_WINDOW |  PFD_SUPPORT_OPENGL  |  PFD_DOUBLEBUFFER | PFD_STEREO;
+
        gldrivername = "opengl32.dll";
// COMMANDLINEOPTION: Windows WGL: -gl_driver <drivername> selects a GL driver library, default is opengl32.dll, useful only for 3dfxogl.dll or 3dfxvgl.dll, if you don't know what this is for, you don't need it
        i = COM_CheckParm("-gl_driver");
syschuck
Newbie
 
Posts: 8
Joined: Sun Sep 24, 2006 6:32 pm

Postby LordHavoc » Wed Oct 18, 2006 3:03 am

syschuck wrote:Hi All,

LordHavoc, I've modified the patches so that there is now a
vid_stereogl cvar and I also left in the -stereogl command line
option as a convenience; when you see the code, I think you will
agree. I've also left in the r_stereo_active cvar for a couple
of reasons; but mainly so that a user at the console could turn
off stereo rendering and then re-enable it later; say for example
debugging purposes without re-initializing the video hardware,
or perhaps a user just gets tied eyes from stereo but doesn't
want to give up the game. The other reason is so the code doesn't
have to use an extern to peek into the cvars of the 'vid_' section
from the 'cl_' section of the code. I'm just trying to follow the
code style there and keep the changes small. Currently that leaves
the openGL's double buffering in a mess but I think a small change
to the console code will fix that.


I am applying your patch, however with some changes:
I'm skipping r_stereo_active as I really can't see enough justification for it - if you choose a stereo buffered video setting, it should be stereo, being able to turn it off is not that useful, and you can get that effect (with less potential buffering problems) with r_stereo_separation 0.
I'm skipping the -stereogl commandline option as I only support commandline options for legacy reasons, it is preferred to use +vid_stereogl 1 on the commandline.
I renamed vid_stereogl to vid_stereobuffer because I don't think it is correct to refer to OpenGL in a video option setting when it is not really specific to OpenGL (I'm sure Direct3D has an equivilant feature, if I ever get around to adding Direct3D support someday).
I added more qglDrawBuffer calls, especially to the loading screen code.
I changed the Vid_Mode setup to take stereo as a parameter, and properly turn it off if the mode set fails.

syschuck wrote: Regarding the gun positioning, I can't find where the gun
coordinates are located. Are they in the model itself?
I don't think it's toe-in like kyre suggested (good URL kyre)
Everything else seems to have very good depth qualities even
close up.


You're looking for the cl_bobmodel stuff in view.c.
I'll add a cl_viewmodel_scale cvar to allow changing the gun size back to 1.0 (just don't go too near a wall!).

I've noticed that in Doom3 the gun lowers if you get too near a wall, which may be a better behavior but not one I can implement easily in the engine for several compatibility reasons I won't go into here.

syschuck wrote: Anyway, I've been fragging away in eye popping 3D stereo for a weeks now, and it's a blast! Usually me getting blasted! :-) I'm such a novice.


I can't directly apply your patch due to the whitespace (tabs and blank lines) being mangled by the forum, so I'm applying it manually.

In future it would be better to post it on a nopaste site and give the URL, as those services have a download option to get the original text.

I'd like to see stereo 3D but I don't have suitable hardware and the hardware seems to be quite expensive; I use LCDs so I would need to get a head mounted display from i-glasses instead of the usual shutter-glasses, and the Linux NVIDIA drivers only support stereo graphics on the Quadro models as far as I know, which are even more expensive than the head mounted display.

Although I could use the windows XP machine next to me for testing as it has a CRT and thus could use shutter glasses and the windows nvidia drivers support stereo even on non-Quadro models, I don't know if I'd have to buy anything extra to get the driver support though (as normally the shutter-glasses come with specific brands of nvidia card, I don't know if I could just buy them separately).
LordHavoc
Site Admin
 
Posts: 191
Joined: Wed Mar 29, 2006 7:39 am
Location: western Oregon, USA

Postby syschuck » Wed Oct 25, 2006 6:53 am

Lordhavac and All,

Thanks for accepting the patch for quadbuffer stereo. I think your changes
sound cool and your game engine rocks anyway. Yeeppeee! Yeepeee!!!
This is the first FPS game that I know that supports Quadbuffer stereo natively
with Linux, BSD, Mac OS-X, and Windows. I hope it will set a trend with other games.

Best Regards,
Chuck
syschuck
Newbie
 
Posts: 8
Joined: Sun Sep 24, 2006 6:32 pm

Next

Return to Nexuiz - Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron