summaryrefslogtreecommitdiff
path: root/src/render/shaders
diff options
context:
space:
mode:
authorFelix Dick <felix.dick@web.de>2022-09-29 23:19:56 +0200
committerFelix Dick <felix.dick@web.de>2022-09-29 23:19:56 +0200
commit6eb7d0038644fab09c8512ad34cdcbde1882ffc0 (patch)
treea4bb4f382b25a924b04923a5fa52ba98e6e1d5f2 /src/render/shaders
parente5dced8b3fccfe0048a55da197b8851e956a08ef (diff)
Send absolute screen coordinates to texture shaders.
Diffstat (limited to 'src/render/shaders')
-rw-r--r--src/render/shaders/Textures.hpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/render/shaders/Textures.hpp b/src/render/shaders/Textures.hpp
index 42bd0856..a7c53aea 100644
--- a/src/render/shaders/Textures.hpp
+++ b/src/render/shaders/Textures.hpp
@@ -6,10 +6,10 @@ inline static constexpr auto ROUNDED_SHADER_FUNC = [](const std::string colorVar
return R"#(
// branchless baby!
- vec2 bottomRight = fullSize - radius;
- vec2 pixCoord = v_texcoord - vec2(0.5);
- pixCoord *= (vec2(lessThan(pixCoord, vec2(0.0))) * vec2(-2.0) + vec2(1.0)) * fullSize;
- pixCoord -= (bottomRight - topLeft) * vec2(0.5);
+ highp vec2 pixCoord = vec2(gl_FragCoord);
+ pixCoord -= (topLeft + fullSize / vec2(2.0));
+ pixCoord *= (vec2(lessThan(pixCoord, vec2(0.0))) * vec2(-2.0) + vec2(1.0));
+ pixCoord -= fullSize * vec2(0.5) - vec2(radius);
if (all(greaterThan(pixCoord, vec2(0.0)))) {