mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 12:32:34 +00:00
Modulate row interleaved stereo 3d offset with window height parity, because gl_FragCoord.y approaches zero at the bottom, not the top of the window.
This commit is contained in:
parent
576619504e
commit
0240cdef18
2 changed files with 8 additions and 4 deletions
|
@ -99,7 +99,10 @@ void RowInterleaved3D::Present() const
|
||||||
GLRenderer->mScreenViewport.width / (float)GLRenderer->mBuffers->GetWidth(),
|
GLRenderer->mScreenViewport.width / (float)GLRenderer->mBuffers->GetWidth(),
|
||||||
GLRenderer->mScreenViewport.height / (float)GLRenderer->mBuffers->GetHeight());
|
GLRenderer->mScreenViewport.height / (float)GLRenderer->mBuffers->GetHeight());
|
||||||
|
|
||||||
GLRenderer->mPresent3dRowShader->VerticalPixelOffset.Set(0); // fixme: vary with window location
|
GLRenderer->mPresent3dRowShader->VerticalPixelOffset.Set(
|
||||||
|
0 // fixme: vary with window location
|
||||||
|
+ box.height % 2 // because we want the top pixel offset, but gl_FragCoord.y is the bottom pixel offset
|
||||||
|
);
|
||||||
|
|
||||||
GLRenderer->RenderScreenQuad();
|
GLRenderer->RenderScreenQuad();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ uniform sampler2D RightEyeTexture;
|
||||||
uniform float InvGamma;
|
uniform float InvGamma;
|
||||||
uniform float Contrast;
|
uniform float Contrast;
|
||||||
uniform float Brightness;
|
uniform float Brightness;
|
||||||
uniform int WindowHeight;
|
|
||||||
uniform int VerticalPixelOffset; // top-of-window might not be top-of-screen
|
uniform int VerticalPixelOffset; // top-of-window might not be top-of-screen
|
||||||
|
|
||||||
vec4 ApplyGamma(vec4 c)
|
vec4 ApplyGamma(vec4 c)
|
||||||
|
@ -20,8 +19,10 @@ vec4 ApplyGamma(vec4 c)
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
int thisVerticalPixel = int(gl_FragCoord.y);
|
int thisVerticalPixel = int(gl_FragCoord.y + 1.0); // Bottom row is typically the right eye, when WindowHeight is even
|
||||||
bool isLeftEye = (thisVerticalPixel + VerticalPixelOffset) % 2 == 0;
|
bool isLeftEye = (thisVerticalPixel // because we want to alternate eye view on each row
|
||||||
|
+ VerticalPixelOffset // because the window might not be aligned to the screen
|
||||||
|
) % 2 == 0;
|
||||||
vec4 inputColor;
|
vec4 inputColor;
|
||||||
if (isLeftEye) {
|
if (isLeftEye) {
|
||||||
inputColor = texture(LeftEyeTexture, TexCoord);
|
inputColor = texture(LeftEyeTexture, TexCoord);
|
||||||
|
|
Loading…
Reference in a new issue