From ce6327142343b6e7f929f6c37be56eec39e1387a Mon Sep 17 00:00:00 2001 From: Bela Bohlender Date: Wed, 14 Aug 2024 17:13:05 +0200 Subject: [PATCH] fix: portal in web xr --- packages/react/src/portal.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/react/src/portal.tsx b/packages/react/src/portal.tsx index 34424dac..a58aa62b 100644 --- a/packages/react/src/portal.tsx +++ b/packages/react/src/portal.tsx @@ -255,6 +255,7 @@ function ChildrenToFBO({ let count = 0 let oldAutoClear let oldXrEnabled + let oldIsPresenting useFrame((state) => { const currentFBO = fbo.peek() if (currentFBO == null) { @@ -263,13 +264,16 @@ function ChildrenToFBO({ if (frames === Infinity || count < frames) { oldAutoClear = state.gl.autoClear oldXrEnabled = state.gl.xr.enabled + oldIsPresenting = state.gl.xr.isPresenting state.gl.autoClear = true state.gl.xr.enabled = false + state.gl.xr.isPresenting = false state.gl.setRenderTarget(currentFBO) state.gl.render(state.scene, state.camera) state.gl.setRenderTarget(null) state.gl.autoClear = oldAutoClear state.gl.xr.enabled = oldXrEnabled + state.gl.xr.isPresenting = oldIsPresenting count++ } }, renderPriority)