MDN self-hosted library · e01.org

GPURenderPassEncoder: setViewport() method

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
passEncoder.setViewport(0, 0, canvas.width / 2, canvas.height / 2, 0, 1);
js
// …

colorPass.setViewport(
  (canvas.width * m) / 2,
  0,
  canvas.width / 2,
  canvas.height,
  0,
  1,
);

// …