Refactor: simplify iResolution uniform calculation by removing devicePixelRatio scaling and using gl.uniform3fv.
This commit is contained in:
parent
12592e3726
commit
f58ff49c46
@ -993,13 +993,10 @@ export function ShaderBackground() {
|
|||||||
"iResolution uniform not found (maybe not used by shader)."
|
"iResolution uniform not found (maybe not used by shader)."
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// Optionally convert to physical pixels:
|
const w = canvas.width;
|
||||||
const dpr = window.devicePixelRatio || 1;
|
const h = canvas.height;
|
||||||
const w = canvas.clientWidth * dpr;
|
|
||||||
const h = canvas.clientHeight * dpr;
|
|
||||||
|
|
||||||
// set as vec3: x = width, y = height, z = pixel aspect (often 1.0)
|
gl.uniform3fv(loc, [w, h, 1]);
|
||||||
gl.uniform3f(loc, w, h, 1.0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user