From 217601f3385d771ed657bff023b98d3ef8a7724f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 4 Sep 2016 01:46:29 +0200 Subject: [PATCH] - fixed: FPortal::ClearScreen may not use the 2D drawing code anymore. 2D calls are accumulated and then executed all at once at the end of the frame, but this one needs to be interleaved with the 3D rendering. It now uses the quad drawer to fill the portal with blackness. --- src/gl/scene/gl_portal.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/gl/scene/gl_portal.cpp b/src/gl/scene/gl_portal.cpp index cd3efb9e3b..b613032ea1 100644 --- a/src/gl/scene/gl_portal.cpp +++ b/src/gl/scene/gl_portal.cpp @@ -56,6 +56,7 @@ #include "gl/renderer/gl_lightdata.h" #include "gl/renderer/gl_renderer.h" #include "gl/renderer/gl_renderstate.h" +#include "gl/renderer/gl_quaddrawer.h" #include "gl/dynlights/gl_glow.h" #include "gl/data/gl_data.h" #include "gl/data/gl_vertexbuffer.h" @@ -128,8 +129,21 @@ void GLPortal::ClearScreen() bool multi = !!glIsEnabled(GL_MULTISAMPLE); gl_MatrixStack.Push(gl_RenderState.mViewMatrix); gl_MatrixStack.Push(gl_RenderState.mProjectionMatrix); - screen->Begin2D(false); - screen->Dim(0, 1.f, 0, 0, SCREENWIDTH, SCREENHEIGHT); + + gl_RenderState.mViewMatrix.loadIdentity(); + gl_RenderState.mProjectionMatrix.ortho(0, SCREENWIDTH, SCREENHEIGHT, 0, -1.0f, 1.0f); + gl_RenderState.ApplyMatrices(); + + glDisable(GL_MULTISAMPLE); + glDisable(GL_DEPTH_TEST); + + FQuadDrawer qd; + qd.Set(0, 0, 0, 0, 0, 0); + qd.Set(1, 0, SCREENHEIGHT, 0, 0, 0); + qd.Set(2, SCREENWIDTH, SCREENHEIGHT, 0, 0, 0); + qd.Set(3, SCREENWIDTH, 0, 0, 0, 0); + qd.Render(GL_TRIANGLE_FAN); + glEnable(GL_DEPTH_TEST); gl_MatrixStack.Pop(gl_RenderState.mProjectionMatrix); gl_MatrixStack.Pop(gl_RenderState.mViewMatrix); @@ -137,7 +151,6 @@ void GLPortal::ClearScreen() if (multi) glEnable(GL_MULTISAMPLE); } - //----------------------------------------------------------------------------- // // DrawPortalStencil