diff --git a/src/gl/stereo3d/gl_quadstereo.h b/src/gl/stereo3d/gl_quadstereo.h index 615746ae7..f27fb78f8 100644 --- a/src/gl/stereo3d/gl_quadstereo.h +++ b/src/gl/stereo3d/gl_quadstereo.h @@ -84,7 +84,7 @@ class QuadStereo : public Stereo3DMode { public: QuadStereo(double ipdMeters); - static const QuadStereo& QuadStereo::getInstance(float ipd); + static const QuadStereo& getInstance(float ipd); private: QuadStereoLeftPose leftEye; QuadStereoRightPose rightEye; diff --git a/src/gl/stereo3d/gl_stereo_cvars.cpp b/src/gl/stereo3d/gl_stereo_cvars.cpp index 9f1f30505..e7d08df41 100644 --- a/src/gl/stereo3d/gl_stereo_cvars.cpp +++ b/src/gl/stereo3d/gl_stereo_cvars.cpp @@ -42,7 +42,10 @@ // Set up 3D-specific console variables: CVAR(Int, vr_mode, 0, CVAR_GLOBALCONFIG) -EXTERN_CVAR(Bool, vr_enable_quadbuffered) +// For broadest GL compatibility, require user to explicitly enable quad-buffered stereo mode. +// Setting vr_enable_quadbuffered_stereo does not automatically invoke quad-buffered stereo, +// but makes it possible for subsequent "vr_mode 7" to invoke quad-buffered stereo +CVAR(Bool, vr_enable_quadbuffered, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) // intraocular distance in meters CVAR(Float, vr_ipd, 0.062f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // METERS @@ -90,7 +93,7 @@ const Stereo3DMode& Stereo3DMode::getCurrentMode() else { setCurrentMode(MonoView::getInstance()); } - break ; + break; // TODO: 8: Oculus Rift case 9: setCurrentMode(AmberBlue::getInstance(vr_ipd)); diff --git a/src/win32/win32gliface.cpp b/src/win32/win32gliface.cpp index 1fab45406..27cb562e2 100644 --- a/src/win32/win32gliface.cpp +++ b/src/win32/win32gliface.cpp @@ -47,11 +47,7 @@ CUSTOM_CVAR(Int, gl_vid_multisample, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_ CVAR(Bool, gl_debug, false, 0) -// For broadest GL compatibility, require user to explicitly enable quad-buffered stereo mode. -// Setting vr_enable_quadbuffered_stereo does not automatically invoke quad-buffered stereo, -// but makes it possible for subsequent "vr_mode 7" to invoke quad-buffered stereo -CVAR(Bool, vr_enable_quadbuffered, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) - +EXTERN_CVAR(Bool, vr_enable_quadbuffered) EXTERN_CVAR(Int, vid_refreshrate) //========================================================================== @@ -623,6 +619,7 @@ bool Win32GLVideo::SetPixelFormat() bool Win32GLVideo::SetupPixelFormat(int multisample) { + int i; int colorDepth; HDC deskDC; int attributes[28]; @@ -656,31 +653,32 @@ bool Win32GLVideo::SetupPixelFormat(int multisample) attributes[16] = WGL_DOUBLE_BUFFER_ARB; attributes[17] = true; - // [BB] Starting with driver version 314.07, NVIDIA GeForce cards support OpenGL quad buffered - // stereo rendering with 3D Vision hardware. Select the corresponding attribute here. - attributes[18] = vr_enable_quadbuffered ? WGL_STEREO_ARB : 0; - attributes[19] = true; - - attributes[20] = WGL_ACCELERATION_ARB; //required to be FULL_ACCELERATION_ARB - attributes[21] = WGL_FULL_ACCELERATION_ARB; - if (multisample > 0) { - attributes[22] = WGL_SAMPLE_BUFFERS_ARB; - attributes[23] = true; - attributes[24] = WGL_SAMPLES_ARB; - attributes[25] = multisample; + attributes[18] = WGL_SAMPLE_BUFFERS_ARB; + attributes[19] = true; + attributes[20] = WGL_SAMPLES_ARB; + attributes[21] = multisample; + i = 22; } else { - attributes[22] = 0; - attributes[23] = 0; - attributes[24] = 0; - attributes[25] = 0; + i = 18; + } + + attributes[i++] = WGL_ACCELERATION_ARB; //required to be FULL_ACCELERATION_ARB + attributes[i++] = WGL_FULL_ACCELERATION_ARB; + + if (vr_enable_quadbuffered) + { + // [BB] Starting with driver version 314.07, NVIDIA GeForce cards support OpenGL quad buffered + // stereo rendering with 3D Vision hardware. Select the corresponding attribute here. + attributes[i++] = WGL_STEREO_ARB; + attributes[i++] = true; } - attributes[26] = 0; - attributes[27] = 0; + attributes[i++] = 0; + attributes[i++] = 0; if (!myWglChoosePixelFormatARB(m_hDC, attributes, attribsFloat, 1, &pixelFormat, &numFormats)) {