summaryrefslogtreecommitdiff
path: root/shader.frag
blob: 47412362852576be3bc6867ca4e7ceccac61bb21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#version 440 core
#ifdef GL_ES
precision mediump float;
#endif

uniform vec2 resolution;
uniform float time;

uniform sampler2D images[4];
uniform float ratios[4];
uniform float params[32];

out vec4 fragColor;

float random (in float x) {
  return fract(sin(x)*43758.5453123)-0.5;
}

vec4 image(int i) {
	vec2 st = gl_FragCoord.xy/resolution.xy;
  st.x *= ratios[i];
  st.x += (1-ratios[i])*0.5;
  return texture2D(images[i],st);
}

void main (void) {
	vec4 img1 = mix(image(0),image(1),sin(time));
	vec4 img2 = mix(image(2),image(3),cos(time));
  fragColor = mix(img1,img2,params[1]);
}