Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGLRenderer: Do not run window.rAF when in XR. #21529

Merged
merged 3 commits into from
Mar 26, 2021
Merged

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Mar 26, 2021

Related issue: Fixed #18666.

Description

I've tested this change with a Oculus Quest (1). When in XR, the animation loop of the window context is now stopped. A check for xr.isPresenting is not necessary anymore.

@marcofugaro
Copy link
Contributor

What about AR examples that still need to render in the animationLoop to run?

renderer.setAnimationLoop( render );

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Mar 26, 2021

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Mar 26, 2021

Updated the builds for further testing.

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Mar 26, 2021

There should be no difference compared to prod. When you are currently in XR, the following line prevents that the defined animation callback (which is set via renderer.setAnimationLoop()) is executed in context of window:

if ( xr.isPresenting ) return;

With this PR, the entire window animation loop is stopped and does not run in the background anymore. Hence, the above check can be removed.

@marcofugaro
Copy link
Contributor

Okay! I tested the AR examples and they work the same 🙂

@mrdoob mrdoob added this to the r127 milestone Mar 26, 2021
@mrdoob
Copy link
Owner

mrdoob commented Mar 26, 2021

Hmm, I think when I did that was because these events were not reliable 🤔
We'll see what happens now 🤞🤓

@mrdoob mrdoob merged commit c6d8d9b into mrdoob:dev Mar 26, 2021
@mrdoob
Copy link
Owner

mrdoob commented Mar 26, 2021

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not call window.requestAnimationFrame when in webxr mode
3 participants