mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 21:21:04 +00:00
Fix incorrect viewport location when not using fullscreen HUD
This commit is contained in:
parent
d3457f4508
commit
a6354c74cf
5 changed files with 17 additions and 19 deletions
|
@ -198,7 +198,7 @@ void FGLRenderer::BloomScene()
|
|||
|
||||
// Add bloom back to scene texture:
|
||||
mBuffers->BindSceneTextureFB();
|
||||
glViewport(0, 0, mOutputViewport.width, mOutputViewport.height);
|
||||
glViewport(mOutputViewport.left, mOutputViewport.top, mOutputViewport.width, mOutputViewport.height);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
|
|
|
@ -185,6 +185,7 @@ void FGLRenderer::SetOutputViewport(GL_IRECT *bounds)
|
|||
{
|
||||
mOutputViewport = *bounds;
|
||||
mOutputViewportLB = *bounds;
|
||||
mScreenViewport = *bounds;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -209,6 +210,12 @@ void FGLRenderer::SetOutputViewport(GL_IRECT *bounds)
|
|||
int vw = viewwidth;
|
||||
int vh = viewheight;
|
||||
|
||||
// The entire renderable area, including the 2D HUD
|
||||
mScreenViewport.left = 0;
|
||||
mScreenViewport.top = 0;
|
||||
mScreenViewport.width = framebuffer->GetWidth();
|
||||
mScreenViewport.height = framebuffer->GetHeight();
|
||||
|
||||
// Letterboxed viewport for the main scene
|
||||
mOutputViewportLB.left = viewwindowx;
|
||||
mOutputViewportLB.top = trueheight - bars - (height + viewwindowy - ((height - vh) / 2));
|
||||
|
@ -242,12 +249,8 @@ void FGLRenderer::Begin2D()
|
|||
mBuffers->BindSceneFB();
|
||||
else
|
||||
mBuffers->BindHudFB();
|
||||
glViewport(0, 0, mOutputViewport.width, mOutputViewport.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
glViewport(mOutputViewport.left, mOutputViewport.top, mOutputViewport.width, mOutputViewport.height);
|
||||
}
|
||||
glViewport(mScreenViewport.left, mScreenViewport.top, mScreenViewport.width, mScreenViewport.height);
|
||||
|
||||
gl_RenderState.EnableFog(false);
|
||||
gl_RenderState.Set2DMode(true);
|
||||
|
|
|
@ -106,6 +106,7 @@ public:
|
|||
FSkyVertexBuffer *mSkyVBO;
|
||||
FLightBuffer *mLights;
|
||||
|
||||
GL_IRECT mScreenViewport;
|
||||
GL_IRECT mOutputViewportLB;
|
||||
GL_IRECT mOutputViewport;
|
||||
bool mDrawingScene2D = false;
|
||||
|
|
|
@ -157,10 +157,7 @@ void FGLRenderer::SetViewArea()
|
|||
|
||||
void FGLRenderer::Reset3DViewport()
|
||||
{
|
||||
if (FGLRenderBuffers::IsEnabled())
|
||||
glViewport(0, 0, mOutputViewport.width, mOutputViewport.height);
|
||||
else
|
||||
glViewport(mOutputViewport.left, mOutputViewport.top, mOutputViewport.width, mOutputViewport.height);
|
||||
glViewport(mOutputViewport.left, mOutputViewport.top, mOutputViewport.width, mOutputViewport.height);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -171,20 +168,16 @@ void FGLRenderer::Reset3DViewport()
|
|||
|
||||
void FGLRenderer::Set3DViewport(bool toscreen)
|
||||
{
|
||||
const auto &bounds = mOutputViewportLB;
|
||||
if (toscreen && FGLRenderBuffers::IsEnabled())
|
||||
{
|
||||
mBuffers->Setup(mOutputViewport.width, mOutputViewport.height);
|
||||
mBuffers->BindSceneFB();
|
||||
glViewport(0, 0, bounds.width, bounds.height);
|
||||
glScissor(0, 0, bounds.width, bounds.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
glViewport(bounds.left, bounds.top, bounds.width, bounds.height);
|
||||
glScissor(bounds.left, bounds.top, bounds.width, bounds.height);
|
||||
}
|
||||
|
||||
const auto &bounds = mOutputViewportLB;
|
||||
glViewport(bounds.left, bounds.top, bounds.width, bounds.height);
|
||||
glScissor(bounds.left, bounds.top, bounds.width, bounds.height);
|
||||
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
|
|
@ -233,7 +233,8 @@ bool OpenGLFrameBuffer::WipeDo(int ticks)
|
|||
if (FGLRenderBuffers::IsEnabled())
|
||||
{
|
||||
GLRenderer->mBuffers->BindHudFB();
|
||||
glViewport(0, 0, GLRenderer->mOutputViewport.width, GLRenderer->mOutputViewport.height);
|
||||
const auto &bounds = GLRenderer->mScreenViewport;
|
||||
glViewport(bounds.left, bounds.top, bounds.width, bounds.height);
|
||||
}
|
||||
|
||||
bool done = ScreenWipe->Run(ticks, this);
|
||||
|
|
Loading…
Reference in a new issue