Skip to content

R3F & StereoCamera #3219

Discussion options

You must be logged in to vote

The reason for this is R3F will render your scene by default unless you specify a render priority to useFrame above 0, and you're leaking scissor state to that render so it can be hard to judge from a glance.

useFrame(({ gl, scene, camera, size }) => {
  stereoCamera.current.update(camera);

  if (gl.autoClear) gl.clear();
  gl.autoClear = false;

  gl.setScissorTest(true);

  gl.setScissor(0, 0, size.width / 2, size.height);
  gl.setViewport(0, 0, size.width / 2, size.height);
  gl.render(scene, stereoCamera.current.cameraL);

  gl.setScissor(size.width / 2, 0, size.width / 2, size.height);
  gl.setViewport(size.width / 2, 0, size.width / 2, size.height);
  gl.render(scene, stereoCamera.c…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MaxTwentythree
Comment options

Answer selected by MaxTwentythree
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #3215 on March 25, 2024 03:09.