From 2707a1d221931f4c1aa6e5fb89f0eddd01c2c4f0 Mon Sep 17 00:00:00 2001 From: Kai Blaschke Date: Sat, 18 Mar 2023 13:48:00 +0100 Subject: [PATCH] Fix uv_orig coordinates in warp shader. Should fix visuals in about half of the presets. --- src/libprojectM/Renderer/StaticGlShaders.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libprojectM/Renderer/StaticGlShaders.cpp b/src/libprojectM/Renderer/StaticGlShaders.cpp index e2918025c..e2b10ed26 100644 --- a/src/libprojectM/Renderer/StaticGlShaders.cpp +++ b/src/libprojectM/Renderer/StaticGlShaders.cpp @@ -546,6 +546,10 @@ void main() { vec2 uv = vec2(pos.x * aspectX * 0.5 * zoom2Inverse + 0.5, pos.y * aspectY * 0.5 * zoom2Inverse + 0.5); + // original UV coordinates + vec2 uv_original = vec2(pos.x * 0.5 + 0.5 + texelOffset.x, + -pos.y * 0.5 + 0.5 + texelOffset.y); + // Stretch on X, Y uv.x = (uv.x - center.x) / stretch.x + center.x; uv.y = (uv.y - center.y) / stretch.y + center.y; @@ -577,7 +581,7 @@ void main() { frag_COLOR = vec4(decay, decay, decay, 1.0); frag_TEXCOORD0.xy = uv; - frag_TEXCOORD0.zw = gl_Position.xy; + frag_TEXCOORD0.zw = uv_original; frag_TEXCOORD1 = vertex_position.zw; } )";