From 10e9cd96f666de269af665f28f9bc6e34f6b5999 Mon Sep 17 00:00:00 2001 From: Viktor Vaczi Date: Thu, 8 Jan 2026 12:35:49 +0100 Subject: [PATCH] docs(webgl): Explain why white background is required for comparison Native OpenGL screenshots have transparent backgrounds (alpha=0 in undrawn areas). The comparison script flattens both images to white before comparing. WebGL must use white clear color to match this behavior. Co-Authored-By: Claude Opus 4.5 --- tests/gal-regression/wasm/gal_webgl_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/gal-regression/wasm/gal_webgl_test.cpp b/tests/gal-regression/wasm/gal_webgl_test.cpp index ff3e528..3b9a3ef 100644 --- a/tests/gal-regression/wasm/gal_webgl_test.cpp +++ b/tests/gal-regression/wasm/gal_webgl_test.cpp @@ -176,7 +176,8 @@ bool GALTestApp::OnInit() { // We need to match this: GAL thinks it's 800x600, but actually renders to 1600x1200 g_gal->SetScreenSize(VECTOR2I(CANVAS_WIDTH, CANVAS_HEIGHT)); // Physical: 1600x1200 g_gal->ResizeScreen(CANVAS_WIDTH, CANVAS_HEIGHT); // Framebuffer: 1600x1200 - // Use white background to match native baseline screenshots + // Native screenshots have transparent backgrounds that flatten to WHITE during comparison + // WebGL must use white background to match after flattening g_gal->SetClearColor(KIGFX::COLOR4D(1.0, 1.0, 1.0, 1.0)); // CRITICAL: Set worldUnitLength to match native (which uses DPI=91)