diff options
author | Christoph Helma <helma@in-silico.ch> | 2017-07-19 16:35:48 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2017-07-19 16:35:48 +0200 |
commit | 22fad493eafe61ba5fa042c85db6c5f253c90517 (patch) | |
tree | 72cdc3f2facf5980b5eea41f005c852cb2665b82 /shader.frag | |
parent | 1baee0d835b144e388ceff53d2c373bc7e887178 (diff) |
image reload
Diffstat (limited to 'shader.frag')
-rw-r--r-- | shader.frag | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/shader.frag b/shader.frag index bba52a5..71a7141 100644 --- a/shader.frag +++ b/shader.frag @@ -1,4 +1,4 @@ -#version 330 core +#version 440 core #ifdef GL_ES precision mediump float; #endif @@ -12,21 +12,24 @@ uniform sampler2D img0; uniform sampler2D img1; uniform sampler2D img2; uniform sampler2D img3; -//uniform vec2 u_tex0Resolution; +uniform float img0ratio; +uniform float img1ratio; +uniform float img2ratio; +uniform float img3ratio; +out vec4 fragColor; float random (in float x) { return fract(sin(x)*43758.5453123)-0.5; } void main (void) { vec2 st = gl_FragCoord.xy/resolution.xy; - vec4 i1 = texture2D(img0,st*0.8); - vec4 i2 = texture2D(img1,st); - vec4 i3 = texture2D(img2,st*1.2); - vec4 i4 = texture2D(img3,st); + vec4 i1 = texture2D(img0,st*vec2(img0ratio,1.)); + vec4 i2 = texture2D(img1,st*vec2(img1ratio,1.)); + vec4 i3 = texture2D(img2,st*vec2(img2ratio,1.)); + vec4 i4 = texture2D(img3,st*vec2(img3ratio,1.)); i1 = mix(i1,i2,sin(time)); i2 = mix(i3,i4,cos(time)); - gl_FragColor = mix(i1,i2,0.5); - //gl_FragColor = i2; - //gl_FragColor = texture2D(image1,st*sin(time*2.)); + fragColor = mix(i1,i2,0.5); + //gl_FragColor = i1; } |