Refactor: simplify iResolution uniform calculation by removing devicePixelRatio scaling and using gl.uniform3fv.

This commit is contained in:
code002lover 2025-12-06 21:07:10 +01:00
parent 12592e3726
commit f58ff49c46

View File

@ -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]);
}
}