diff --git a/src/gl/renderer/gl_stereo3d.cpp b/src/gl/renderer/gl_stereo3d.cpp index 6035a67bf1..3155bbdc54 100644 --- a/src/gl/renderer/gl_stereo3d.cpp +++ b/src/gl/renderer/gl_stereo3d.cpp @@ -324,7 +324,7 @@ void FGLRenderer::PresentStereo() return; case VR_GREENMAGENTA: - PresentAnaglyph(false, true, true); + PresentAnaglyph(false, true, false); break; case VR_REDCYAN: diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index 451a9f7cb0..c30f22c63d 100644 --- a/src/gl/system/gl_framebuffer.cpp +++ b/src/gl/system/gl_framebuffer.cpp @@ -377,7 +377,7 @@ void OpenGLFrameBuffer::SetViewportRects(IntRect *bounds) if (!bounds) { auto vrmode = VRMode::GetVRMode(true); - vrmode->AdjustViewport(); + vrmode->AdjustViewport(this); } } diff --git a/src/hwrenderer/utility/hw_vrmodes.cpp b/src/hwrenderer/utility/hw_vrmodes.cpp index d43ad1f76a..ebb2aad9fd 100644 --- a/src/hwrenderer/utility/hw_vrmodes.cpp +++ b/src/hwrenderer/utility/hw_vrmodes.cpp @@ -93,7 +93,7 @@ const VRMode *VRMode::GetVRMode(bool toscreen) } } -void VRMode::AdjustViewport() const +void VRMode::AdjustViewport(DFrameBuffer *screen) const { screen->mSceneViewport.height = (int)(screen->mSceneViewport.height * mVerticalViewportScale); screen->mSceneViewport.top = (int)(screen->mSceneViewport.top * mVerticalViewportScale); @@ -109,11 +109,11 @@ void VRMode::AdjustViewport() const VSMatrix VRMode::GetHUDSpriteProjection() const { VSMatrix mat; - int w = screen->mScreenViewport.width; - int h = screen->mScreenViewport.height; - float scaled_w = w * mWeaponProjectionScale; - float left_ofs = (scaled_w - w) / 2.f; - mat.ortho(left_ofs, left_ofs + w, (float)h, 0, -1.0f, 1.0f); + int w = screen->GetWidth(); + int h = screen->GetHeight(); + float scaled_w = w / mWeaponProjectionScale; + float left_ofs = (w - scaled_w) / 2.f; + mat.ortho(left_ofs, left_ofs + scaled_w, (float)h, 0, -1.0f, 1.0f); return mat; } diff --git a/src/hwrenderer/utility/hw_vrmodes.h b/src/hwrenderer/utility/hw_vrmodes.h index db4fe39850..43caa83d74 100644 --- a/src/hwrenderer/utility/hw_vrmodes.h +++ b/src/hwrenderer/utility/hw_vrmodes.h @@ -2,6 +2,7 @@ #include "r_data/matrix.h" +class DFrameBuffer; enum { @@ -41,6 +42,6 @@ struct VRMode VREyeInfo mEyes[2]; static const VRMode *GetVRMode(bool toscreen = true); - void AdjustViewport() const; + void AdjustViewport(DFrameBuffer *fb) const; VSMatrix GetHUDSpriteProjection() const; };