Fix compare shader(s)

This commit is contained in:
Joscha 2017-04-24 17:25:26 +00:00
parent 74051fe676
commit 1171c37f88
3 changed files with 47 additions and 9 deletions

View file

@ -4,16 +4,16 @@
// try isampler2D, ivec4 etc.? Probably not
uniform vec2 size;
uniform vec2 offs;
uniform sampler2D base;
uniform sampler2D curr;
void main(void)
{
vec2 pos = gl_FragCoord.xy/size;
// vec4 color = texture(curr, pos); // fails for some reason!?
// vec4 basecolor = texture(base, pos); // fails too...
// color.xyz = abs(color.xyz - basecolor.xyz);
// gl_FragColor = color;
// gl_FragColor = basecolor;
gl_FragColor = vec4(1.0);
vec2 pos = (gl_FragCoord.xy-offs)/size;
pos.y = 1.0 - pos.y;
vec4 color = texture2D(curr, pos);
vec4 basecolor = texture2D(base, pos);
color.xyz = abs(color.xyz - basecolor.xyz);
gl_FragColor = color;
}