consider device pixel density

This commit is contained in:
Luca Conte 2025-04-27 16:48:09 +02:00
parent 57b6851c8d
commit 2d7fb37165
1 changed files with 3 additions and 2 deletions

View File

@ -41,8 +41,9 @@ let smoothCameraDistance = 4;
let mouseDragging = false;
function resizeCanvas() {
cv.width = cv.parentElement.clientWidth;
cv.height = cv.parentElement.clientHeight;
const dpr = window.devicePixelRatio;
cv.width = cv.parentElement.clientWidth * dpr;
cv.height = cv.parentElement.clientHeight * dpr;
gl.viewport(0, 0, cv.width, cv.height);
}