Skip to content

Commit

Permalink
fix: portal for xr
Browse files Browse the repository at this point in the history
  • Loading branch information
bbohlender committed Aug 14, 2024
1 parent ce63271 commit f6c6906
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/react/src/portal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ function ChildrenToFBO({
let oldAutoClear
let oldXrEnabled
let oldIsPresenting
let oldRenderTarget
useFrame((state) => {
const currentFBO = fbo.peek()
if (currentFBO == null) {
Expand All @@ -265,12 +266,13 @@ function ChildrenToFBO({
oldAutoClear = state.gl.autoClear
oldXrEnabled = state.gl.xr.enabled
oldIsPresenting = state.gl.xr.isPresenting
oldRenderTarget = state.gl.getRenderTarget()
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.setRenderTarget(oldRenderTarget)
state.gl.autoClear = oldAutoClear
state.gl.xr.enabled = oldXrEnabled
state.gl.xr.isPresenting = oldIsPresenting
Expand Down

0 comments on commit f6c6906

Please sign in to comment.