Fix Fitness

- compare both textures with the same side up
- load target from the filename passed to the function
This commit is contained in:
Joscha 2017-05-21 00:01:23 +00:00
parent 5c10ba4a78
commit fb74671204
2 changed files with 5 additions and 5 deletions

View file

@ -16,16 +16,16 @@ void main(void)
if (horizontal) {
float posy = gl_FragCoord.y/size.y;
for (float x=0.0; x<=1.0; x+=(1.0/size.x)) {
vec4 color = texture2D(curr, vec2(x, posy));
vec4 basecolor = texture2D(base, vec2(x, 1.0-posy));
vec4 color = texture2D(curr, vec2(x, posy));
vec4 basecolor = texture2D(base, vec2(x, posy));
color.rgb = abs(color.rgb - basecolor.rgb);
total = total + color.r + color.g + color.b;
}
} else {
float posx = gl_FragCoord.x/size.x;
for (float y=0.0; y<=1.0; y+=(1.0/size.y)) {
vec4 color = texture2D(curr, vec2(posx, y));
vec4 basecolor = texture2D(base, vec2(posx, 1.0-y));
vec4 color = texture2D(curr, vec2(posx, y));
vec4 basecolor = texture2D(base, vec2(posx, y));
color.rgb = abs(color.rgb - basecolor.rgb);
total = total + color.r + color.g + color.b;
}