From: Vadim Trochinsky Date: Tue, 18 May 2010 17:05:37 +0000 (+0200) Subject: Moved stereo initialization code to a separate file. X-Git-Url: https://git.jsancho.org/?p=lugaru.git;a=commitdiff_plain;h=8aea302e15fb002424dc0fd0d3746f83a48f671e Moved stereo initialization code to a separate file. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d37995..c56a43a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,7 @@ set(LUGARU_SRCS ${SRCDIR}/OpenGL_Windows.cpp ${SRCDIR}/openal_wrapper.cpp ${SRCDIR}/WinInput.cpp + ${SRCDIR}/Stereo.cpp ) set(LUGARU_H @@ -110,6 +111,7 @@ set(LUGARU_H ${SRCDIR}/pack_private.h ${SRCDIR}/private.h ${SRCDIR}/unpack_private.h + ${SRCDIR}/Stereo.h ) if(UNIX) diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index 576df7e..d4251fc 100644 --- a/Source/OpenGL_Windows.cpp +++ b/Source/OpenGL_Windows.cpp @@ -1037,56 +1037,11 @@ Boolean SetUp (Game & game) game.newscreenwidth=screenwidth; game.newscreenheight=screenheight; - GLint stencilbits = 0; - glGetIntegerv(GL_STENCIL_BITS, &stencilbits); - if ( stencilbits < 1 ) { - fprintf(stderr, "Failed to get a stencil buffer!\n"); - SDL_Quit(); - return false; - } - - if ( stereomode == stereoHorizontalInterlaced || stereomode == stereoVerticalInterlaced ) { - fprintf(stderr, "Stencil buffer has %i bits, good.\n", stencilbits); - fprintf(stderr, "Screen width is %i, height is %i\n", kContextWidth, kContextHeight); - - 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}; - - 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