precision highp float; attribute vec3 pos; varying vec3 v_pos; void main() { v_pos = pos; gl_Position = vec4(pos*2.0, 1.0); } precision highp float; varying vec3 v_pos; uniform sampler2D video1; uniform sampler2D video2; float mincomp(vec2 v) { return min(v.x, v.y); } float mincomp(vec3 v) { return min(v.x, min(v.y, v.z)); } float maxcomp(vec2 v) { return max(v.x, v.y); } float maxcomp(vec3 v) { return max(v.x, max(v.y, v.z)); } void main() { vec3 uv = v_pos*0.5+0.5; uv.y = 1.0 - uv.y; vec4 frame1 = texture2D(video1, uv.xy); vec4 frame2 = texture2D(video2, uv.xy); vec3 color = mix(frame1.rgb, frame2.rgb, uv); color.b = maxcomp(pow( color, vec3(1.0/2.2) )); gl_FragColor = vec4(color, 1.0); }