summaryrefslogtreecommitdiff
path: root/shader.frag
blob: 5492a95fa2cbae849435ca80bfaa8ed10cd7cda5 (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
#version 450 core
#ifdef GL_ES
precision mediump float;
#endif

uniform vec2 resolution;
uniform float ticks;
uniform int program;

uniform sampler2D images[8];
layout (binding = 0,rgba32f) uniform image2D backbuffer;
uniform float ratios[4];
uniform int idx[2];
uniform float vel[2];
uniform float params[4];

out vec4 fragColor;

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

vec2 coordinates(int i) {
	vec2 st = gl_FragCoord.xy/resolution.xy;
  return st;
}

void main (void) {
  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));
  img.rgb = img.rgb*params[0];
  fragColor = img;
}