From 10c84a84785832de974e944791432c5aedd1746a Mon Sep 17 00:00:00 2001 From: syntaxbullet Date: Sat, 21 Feb 2026 13:14:58 +0100 Subject: [PATCH] fix: fix Y - UV coordinate issue flipping the preview in chroma key. --- panel/src/pages/BackgroundRemoval.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/panel/src/pages/BackgroundRemoval.tsx b/panel/src/pages/BackgroundRemoval.tsx index 2d6e384..4d5cf17 100644 --- a/panel/src/pages/BackgroundRemoval.tsx +++ b/panel/src/pages/BackgroundRemoval.tsx @@ -56,7 +56,6 @@ attribute vec2 aPos; varying vec2 vUV; void main() { vUV = aPos * 0.5 + 0.5; - vUV.y = 1.0 - vUV.y; gl_Position = vec4(aPos, 0.0, 1.0); }`; @@ -464,7 +463,9 @@ export function BackgroundRemoval() { gl.bindTexture(gl.TEXTURE_2D, srcTex); gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false); gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, img); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false); gl.bindTexture(gl.TEXTURE_2D, fboTex); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, img.naturalWidth, img.naturalHeight, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);