BGE: adding a fix so 2D filters work properly with side-by-side stereoscopic rendering.
authorMitchell Stokes <mogurijin@gmail.com>
Mon, 15 Jul 2013 22:44:48 +0000 (22:44 +0000)
committerMitchell Stokes <mogurijin@gmail.com>
Mon, 15 Jul 2013 22:44:48 +0000 (22:44 +0000)
source/gameengine/Rasterizer/RAS_2DFilterManager.cpp

index 79ce85382108dfb53272e85c9e0614741b772506..bfe29a48c6945123a80d5165cbb657d2f316a2e3 100644 (file)
@@ -429,6 +429,11 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
        glActiveTextureARB(GL_TEXTURE0);
        canvas->SetViewPort(0, 0, rect_width-1, rect_height-1);
 
+       // We do this to make side-by-side stereo rendering work correctly with 2D filters. It would probably be nicer to just set the viewport,
+       // but it can be easier for writing shaders to have the coordinates for the whole screen instead of just part of the screen. 
+       RAS_Rect scissor_rect = canvas->GetDisplayArea();
+       glScissor(scissor_rect.GetLeft()+viewport[0], scissor_rect.GetBottom()+viewport[1], scissor_rect.GetWidth()+1, scissor_rect.GetHeight()+1);
+
        glDisable(GL_DEPTH_TEST);
        // in case the previous material was wire
        glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);