Fix incorrect viewport location when not using fullscreen HUD

This commit is contained in:
Magnus Norddahl 2016-07-31 13:23:49 +02:00
commit a6354c74cf
5 changed files with 17 additions and 19 deletions

View file

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