aboutsummaryrefslogtreecommitdiff
path: root/pass1.frag
diff options
context:
space:
mode:
Diffstat (limited to 'pass1.frag')
-rw-r--r--pass1.frag15
1 files changed, 7 insertions, 8 deletions
diff --git a/pass1.frag b/pass1.frag
index 725c854..784a9a2 100644
--- a/pass1.frag
+++ b/pass1.frag
@@ -2,24 +2,23 @@
#include "consts.h"
-out vec4 color;
+layout(location = 0) out vec4 color;
in vec4 gl_FragCoord;
-uniform float time;
-uniform sampler2D buf;
-
-ivec2 window = ivec2(RES_H, RES_V);
+layout(location = U_LOC_TIME) uniform float time;
+layout(location = U_LOC_PASS1) uniform sampler2D buf;
+ivec2 res = ivec2(RES_H, RES_V);
void main() {
vec2 point = vec2(sin(time), cos(time)) * 0.7;
- point.x *= float(window.y) / float(window.x); // adjust for aspect ratio
- point = ((point + 1.0) / 2.0) * window.xy; // convert to screen coords
+ point.x *= float(res.y) / float(res.x); // adjust for aspect ratio
+ point = ((point + 1.0) / 2.0) * res.xy; // convert to screen coords
float r = 20.0; // circle radius
color = vec4(0.0);
if (length(gl_FragCoord.xy - point) < r)
color = vec4(1.0);
- color += texture(buf, gl_FragCoord.xy / window.xy) * 0.95;
+ color += texture(buf, gl_FragCoord.xy / res.xy) * 0.95;
}