X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FStereo.cpp;h=b99c18e896e556c837a773d7031d238ebd824382;hb=37aebc9e3fe24a45f04b35ff27e9d767014f3247;hp=815e177952f27ac8fcbe20baed3d66ec8f25bd44;hpb=8aea302e15fb002424dc0fd0d3746f83a48f671e;p=lugaru.git diff --git a/Source/Stereo.cpp b/Source/Stereo.cpp index 815e177..b99c18e 100644 --- a/Source/Stereo.cpp +++ b/Source/Stereo.cpp @@ -25,7 +25,8 @@ bool CanInitStereo(StereoMode mode) { } else { fprintf(stderr, "Stencil buffer has %i bits, good.\n", stencilbits); } - + return true; + break; default: return false; } @@ -35,52 +36,72 @@ bool CanInitStereo(StereoMode mode) { void InitStereo(StereoMode mode) { switch(mode) { case stereoNone: + glDisable( GL_STENCIL_TEST); return; case stereoAnaglyph: + glDisable( GL_STENCIL_TEST); return; case stereoHorizontalInterlaced: case stereoVerticalInterlaced: fprintf(stderr, "Screen width is %i, height is %i\n", kContextWidth, kContextHeight); + // Setup stencil buffer glEnable( GL_STENCIL_TEST); glClearStencil(0); glClear( GL_STENCIL_BUFFER_BIT ); glStencilFunc(GL_ALWAYS, 0x1, 0x1); glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glPixelStorei(GL_UNPACK_ROW_LENGTH, 3); - glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); - glColorMask( 1.0, 1.0, 1.0, 1.0 ); - char stencil[] = {64,127,255}; - + // Setup viewport glViewport(0,0, kContextWidth, kContextHeight); glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho((GLdouble)0, (GLdouble)kContextWidth, (GLdouble)kContextHeight, 0, -1, 1); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - for(int y=0;y