The next code snippet works as expected on Android 13. It resizes WebGL canvas in Chrome Android browser without problems: https://plnkr.co/edit/H3Swhi3WweVmwgxa
But on Android 7 (Redmi 4X) it draws only the default size of canvas (300x150):
Is it possible to solve it? I set a view port like this:
window.onresize = () => {
const dpr = window.devicePixelRatio;
gl.canvas.width = Math.round(gl.canvas.clientWidth * dpr);
gl.canvas.height = Math.round(gl.canvas.clientHeight * dpr);
gl.viewport(0, 0, gl.canvas.width, gl.canvas.height);
draw();
};
Cross-refs: