- 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.
This commit is contained in:
Christoph Oelckers 2016-09-04 01:46:29 +02:00
parent c3ad0a2f16
commit 217601f338
1 changed files with 16 additions and 3 deletions

View File

@ -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