- fixed issues with recent Stereo3D submission:

* there was a CVAR that was only defined in Windows
 * code did not compile with GCC.
 * due to bad setup it disabled multisampling.
This commit is contained in:
Christoph Oelckers 2016-04-14 10:16:04 +02:00
parent caf80e74c4
commit 328047ea28
3 changed files with 27 additions and 26 deletions

View file

@ -84,7 +84,7 @@ class QuadStereo : public Stereo3DMode
{ {
public: public:
QuadStereo(double ipdMeters); QuadStereo(double ipdMeters);
static const QuadStereo& QuadStereo::getInstance(float ipd); static const QuadStereo& getInstance(float ipd);
private: private:
QuadStereoLeftPose leftEye; QuadStereoLeftPose leftEye;
QuadStereoRightPose rightEye; QuadStereoRightPose rightEye;

View file

@ -42,7 +42,10 @@
// Set up 3D-specific console variables: // Set up 3D-specific console variables:
CVAR(Int, vr_mode, 0, CVAR_GLOBALCONFIG) 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 // intraocular distance in meters
CVAR(Float, vr_ipd, 0.062f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // METERS CVAR(Float, vr_ipd, 0.062f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // METERS

View file

@ -47,11 +47,7 @@ CUSTOM_CVAR(Int, gl_vid_multisample, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_
CVAR(Bool, gl_debug, false, 0) CVAR(Bool, gl_debug, false, 0)
// For broadest GL compatibility, require user to explicitly enable quad-buffered stereo mode. EXTERN_CVAR(Bool, vr_enable_quadbuffered)
// 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(Int, vid_refreshrate) EXTERN_CVAR(Int, vid_refreshrate)
//========================================================================== //==========================================================================
@ -623,6 +619,7 @@ bool Win32GLVideo::SetPixelFormat()
bool Win32GLVideo::SetupPixelFormat(int multisample) bool Win32GLVideo::SetupPixelFormat(int multisample)
{ {
int i;
int colorDepth; int colorDepth;
HDC deskDC; HDC deskDC;
int attributes[28]; int attributes[28];
@ -656,31 +653,32 @@ bool Win32GLVideo::SetupPixelFormat(int multisample)
attributes[16] = WGL_DOUBLE_BUFFER_ARB; attributes[16] = WGL_DOUBLE_BUFFER_ARB;
attributes[17] = true; 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) if (multisample > 0)
{ {
attributes[22] = WGL_SAMPLE_BUFFERS_ARB; attributes[18] = WGL_SAMPLE_BUFFERS_ARB;
attributes[23] = true; attributes[19] = true;
attributes[24] = WGL_SAMPLES_ARB; attributes[20] = WGL_SAMPLES_ARB;
attributes[25] = multisample; attributes[21] = multisample;
i = 22;
} }
else else
{ {
attributes[22] = 0; i = 18;
attributes[23] = 0;
attributes[24] = 0;
attributes[25] = 0;
} }
attributes[26] = 0; attributes[i++] = WGL_ACCELERATION_ARB; //required to be FULL_ACCELERATION_ARB
attributes[27] = 0; 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[i++] = 0;
attributes[i++] = 0;
if (!myWglChoosePixelFormatARB(m_hDC, attributes, attribsFloat, 1, &pixelFormat, &numFormats)) if (!myWglChoosePixelFormatARB(m_hDC, attributes, attribsFloat, 1, &pixelFormat, &numFormats))
{ {