From: Vadim Trochinsky Date: Sun, 16 May 2010 18:57:58 +0000 (+0400) Subject: Move stereo reversing code so that it works for all stereo modes. X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=27d69ec51bad8a8ea2742f02e20604119377abe2;p=lugaru.git Move stereo reversing code so that it works for all stereo modes. Fix anaglyph which was accidentally reversed. --- diff --git a/Source/GameDraw.cpp b/Source/GameDraw.cpp index ba527aa..3e07606 100644 --- a/Source/GameDraw.cpp +++ b/Source/GameDraw.cpp @@ -232,18 +232,14 @@ int Game::DrawGLScene(StereoSide side) if ( stereomode == stereoAnaglyph ) { switch(side) { - case stereoLeft: glColorMask( 1.0, 0.0, 0.0, 1.0 ); break; - case stereoRight: glColorMask( 0.0, 1.0, 1.0, 1.0 ); break; + case stereoLeft: glColorMask( 0.0, 1.0, 1.0, 1.0 ); break; + case stereoRight: glColorMask( 1.0, 0.0, 0.0, 1.0 ); break; } } else { glColorMask( 1.0, 1.0, 1.0, 1.0 ); if ( stereomode == stereoHorizontalInterlaced || stereomode == stereoVerticalInterlaced ) { - if (!stereoreverse) { - glStencilFunc(side == stereoLeft ? GL_NOTEQUAL : GL_EQUAL, 0x01, 0x01); - } else { - glStencilFunc(side == stereoLeft ? GL_EQUAL : GL_NOTEQUAL, 0x01, 0x01); - } + glStencilFunc(side == stereoLeft ? GL_NOTEQUAL : GL_EQUAL, 0x01, 0x01); } } @@ -362,7 +358,9 @@ int Game::DrawGLScene(StereoSide side) glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); glLoadIdentity (); - glTranslatef((stereoseparation/2) * side, 0, 0); + // Move the camera for the current eye's point of view. + // Reverse the movement if we're reversing stereo + glTranslatef((stereoseparation/2) * side * (stereoreverse ? -1 : 1), 0, 0); if(!cameramode&&!freeze&&!winfreeze){ glRotatef(float(Random()%100)/10*camerashake/*+(woozy*woozy)/10*/,0,0,1);