From 58f7424b4f31fd0d6d3db6b34e3b09b027ac8da7 Mon Sep 17 00:00:00 2001 From: Deve Date: Sun, 8 May 2016 21:38:24 +0200 Subject: [PATCH] Add a workaround for skybox. The problem was with shader-based pipeline with disabled "advanced effects" in options. In this case we don't use RTTs and gl_FragCoord contains values in range of whole window. So fo 2 players we still get gl_FragCoord.y = 0..window_size instead of gl_FragCoord.y = 0..window_size/2. The easiest way to solve it seems to be modulo it by current viewport size. It should be compatible with advanced pipeline as well as single-player games. Atm. I'm not sure if this should be applied to 0.9.2 branch. It should work fine, but needs some testing. --- data/shaders/sky.frag | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/shaders/sky.frag b/data/shaders/sky.frag index eb339c8a2..4fe5e76b1 100644 --- a/data/shaders/sky.frag +++ b/data/shaders/sky.frag @@ -4,7 +4,7 @@ out vec4 FragColor; void main(void) { - vec3 eyedir = vec3(gl_FragCoord.xy / screen, 1.); + vec3 eyedir = vec3(mod(gl_FragCoord.xy, screen) / screen, 1.); eyedir = 2.0 * eyedir - 1.0; vec4 tmp = (InverseProjectionMatrix * vec4(eyedir, 1.)); tmp /= tmp.w;