blob: 0141563cf5c6d6cf81202d25620ab4ccbbd1fcf5 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#version 450 core
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 resolution;
uniform float ticks;
uniform int program;
uniform sampler2D images[4];
layout (binding = 0,rgba32f) uniform image2D backbuffer;
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 img(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);
}
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;
}
|