The page contains several div elements and I use their positions to define scissor regions on the main canvas, to render different scenes into each div's space
This works fine on desktop but on iOS safari У меня есть это поведение: полотна отстают, действуя странно: < /p>
< /p>
Код: Выделить всё
#main-canvas{
position: fixed;
top: 0;
left: 0;
pointer-events: none;
z-index: 9999;
}
.canvas{
width: 700px;
height: 500px;
border: 1px solid black;
}
let main_canvas = document.getElementById("main-canvas");
function resize_event(){
main_canvas.width = window.innerWidth;
main_canvas.height = window.innerHeight;
}
resize_event();
window.addEventListener("resize", () => resize_event());
let gl = main_canvas.getContext("webgl2");
let colors = [
[1, 0, 0, 1],
[0, 1, 0, 1],
[0, 0, 1, 1],
[1, 1, 0, 1]
];
function update(){
gl.enable(gl.SCISSOR_TEST);
gl.viewport(0, 0, main_canvas.width, main_canvas.height);
gl.clearColor(0, 0, 0, 0);
gl.clear(gl.COLOR_BUFFER_BIT);
let main_canvas_rect = gl.canvas.getBoundingClientRect();
for (let i = 1; i
Подробнее здесь: [url]https://stackoverflow.com/questions/79674032/problem-rendering-fullscreen-fixed-canvas-in-ios-safari[/url]