From 63b28a1d80a7d055616978de8d9f8c1c77f8dc64 Mon Sep 17 00:00:00 2001 From: Christopher Bruns Date: Sun, 2 Oct 2016 16:04:52 -0400 Subject: [PATCH] Retain stereoscopic parity after dragging window in row interleaved 3D mode. --- src/gl/stereo3d/gl_interleaved3d.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gl/stereo3d/gl_interleaved3d.cpp b/src/gl/stereo3d/gl_interleaved3d.cpp index 225f52819..329dec953 100644 --- a/src/gl/stereo3d/gl_interleaved3d.cpp +++ b/src/gl/stereo3d/gl_interleaved3d.cpp @@ -42,6 +42,8 @@ EXTERN_CVAR(Float, vid_brightness) EXTERN_CVAR(Float, vid_contrast) +EXTERN_CVAR(Bool, fullscreen) +EXTERN_CVAR(Int, win_y) // pixel position of top of display window namespace s3d { @@ -99,8 +101,16 @@ void RowInterleaved3D::Present() const GLRenderer->mScreenViewport.width / (float)GLRenderer->mBuffers->GetWidth(), GLRenderer->mScreenViewport.height / (float)GLRenderer->mBuffers->GetHeight()); + // Compute absolute offset from top of screen to top of current display window + // because we need screen-relative, not window-relative, scan line parity + int windowVOffset = 0; + if (! fullscreen) { + I_SaveWindowedPos(); // update win_y CVAR + windowVOffset = win_y; + } + GLRenderer->mPresent3dRowShader->VerticalPixelOffset.Set( - 0 // fixme: vary with window location + windowVOffset // fixme: vary with window location + box.height % 2 // because we want the top pixel offset, but gl_FragCoord.y is the bottom pixel offset );