From f58ff49c46d380a01dad33370a9aa2f4ec383580 Mon Sep 17 00:00:00 2001 From: code002lover Date: Sat, 6 Dec 2025 21:07:10 +0100 Subject: [PATCH] Refactor: simplify iResolution uniform calculation by removing devicePixelRatio scaling and using `gl.uniform3fv`. --- frontend/src/ShaderBackground.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/frontend/src/ShaderBackground.tsx b/frontend/src/ShaderBackground.tsx index 832fa19..73f8a69 100644 --- a/frontend/src/ShaderBackground.tsx +++ b/frontend/src/ShaderBackground.tsx @@ -993,13 +993,10 @@ export function ShaderBackground() { "iResolution uniform not found (maybe not used by shader)." ); } else { - // Optionally convert to physical pixels: - const dpr = window.devicePixelRatio || 1; - const w = canvas.clientWidth * dpr; - const h = canvas.clientHeight * dpr; + const w = canvas.width; + const h = canvas.height; - // set as vec3: x = width, y = height, z = pixel aspect (often 1.0) - gl.uniform3f(loc, w, h, 1.0); + gl.uniform3fv(loc, [w, h, 1]); } }