Variable MATTE_FRAGMENT_SHADERConst
MATTE_FRAGMENT_SHADER: "\nprecision mediump float;\nvarying vec2 v_uv;\nuniform sampler2D u_frame;\nvoid main() {\n vec2 uv = vec2(v_uv.x, 1.0 - v_uv.y);\n vec3 rgb = texture2D(u_frame, vec2(uv.x, uv.y * 0.5)).rgb;\n float a = texture2D(u_frame, vec2(uv.x, 0.5 + uv.y * 0.5)).r;\n gl_FragColor = vec4(rgb * a, a);\n}\n" = ...
Texture row 0 is the TOP of the uploaded frame, while
v_uv.yis 0 at the bottom of the canvas, hence the flip. Colour from the top half, alpha from the bottom half; premultiplied output.