Skip to content

Commit

Permalink
fix: portal in web xr
Browse files Browse the repository at this point in the history
  • Loading branch information
bbohlender committed Aug 14, 2024
1 parent 971c77e commit ce63271
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/react/src/portal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ function ChildrenToFBO({
let count = 0
let oldAutoClear
let oldXrEnabled
let oldIsPresenting
useFrame((state) => {
const currentFBO = fbo.peek()
if (currentFBO == null) {
Expand All @@ -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)
Expand Down

0 comments on commit ce63271

Please sign in to comment.