summaryrefslogtreecommitdiff
path: root/shader.frag
diff options
context:
space:
mode:
Diffstat (limited to 'shader.frag')
-rw-r--r--shader.frag38
1 files changed, 11 insertions, 27 deletions
diff --git a/shader.frag b/shader.frag
index 0141563..4bb6810 100644
--- a/shader.frag
+++ b/shader.frag
@@ -10,7 +10,9 @@ uniform int program;
uniform sampler2D images[4];
layout (binding = 0,rgba32f) uniform image2D backbuffer;
uniform float ratios[4];
-uniform float params[32];
+uniform int idx[2];
+uniform float vel[2];
+uniform float params[4];
out vec4 fragColor;
@@ -18,34 +20,16 @@ float random (in float x) {
return fract(sin(x)*43758.5453123)-0.5;
}
-vec4 img(int i) {
+vec2 coordinates(int i) {
vec2 st = gl_FragCoord.xy/resolution.xy;
- st.x *= ratios[i];
- st.x += (1-ratios[i])*0.5;
- st.x += 0.5;
- return texture2D(images[i],st);
+ return st;
}
void main (void) {
- vec4 image = img(0);
- if (program == 0) {
- image = img(2);
- image.rg = image.gr;
- image = 1.5*image;
- }
- /*
- else {
- ivec2 P = ivec2(gl_FragCoord.xy);
- vec4 buf = imageLoad(backbuffer,P);
- vec4 img1 = mix(img(0),img(1),sin(ticks));
- vec4 img2 = mix(img(2),img(3),cos(ticks));
- buf.bg = buf.gr;
- //buf.b = 0.0;
- vec4 i = mix(img1,img2,0.5);
- //P = ivec2(gl_FragCoord.xy);
- imageStore(backbuffer,P,i);
- image = mix(i,buf,0.8);
- }
- */
- fragColor = image;
+ vec4 img;
+ vec2 st = coordinates(idx[0]);
+ img = texture2D(images[idx[0]],st);
+ st = coordinates(idx[1]);
+ img = pow(img, texture2D(images[idx[1]],st));
+ fragColor = img;
}