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

v9 + WebGPURenderer: gl.xr.addEventListener is not a function #3402

Closed
verekia opened this issue Nov 26, 2024 · 4 comments
Closed

v9 + WebGPURenderer: gl.xr.addEventListener is not a function #3402

verekia opened this issue Nov 26, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@verekia
Copy link
Contributor

verekia commented Nov 26, 2024

With R3F v9.0.0-rc.1 and r171, there is a TypeError: gl.xr.addEventListener is not a function error:

Reproduction:

  • git clone [email protected]:verekia/three-gpu-ecosystem-tests.git
  • cd three-gpu-ecosystem-tests
  • cd next15-app-r3f9-react19
  • npm i --legacy-peer-deps

In next15-app-r3f9-react19/app/page.js, comment out the workaround:

    <Canvas
      style={{ height: '100vh' }}
      gl={canvas => new WebGPURenderer({ canvas })}
      // gl={canvas => {
      //   const renderer = new WebGPURenderer({ canvas })
      //   renderer.xr = { addEventListener: () => {} }
      //   return renderer
      // }}
    >
@verekia verekia changed the title v9: gl.xr.addEventListener is not a function v9 + WebGPURenderer: gl.xr.addEventListener is not a function Nov 26, 2024
@krispya
Copy link
Member

krispya commented Dec 6, 2024

@CodyJasonBennett do you know why this method is required and why it does not exist for WebGPURenderer?

@CodyJasonBennett
Copy link
Member

This is required, so we switch to requestAnimationLoop for WebXRManager to work. This is currently unsupported by WebGPURenderer in three.js mrdoob/three.js#28968. I did relax this check on v8 nearly two years ago in #2947, but never picked it into v9. The next release candidate will contain this fix.

@CodyJasonBennett CodyJasonBennett added the bug Something isn't working label Jan 9, 2025
@verekia
Copy link
Contributor Author

verekia commented Jan 31, 2025

As of Three r173, there is no gl.xr.addEventListener is not a function error anymore.
gl={canvas => new WebGPURenderer({ canvas })} works fine.
Feel free to close if there is nothing else to do on R3F's end!

@CodyJasonBennett
Copy link
Member

This is fixed since 9.0.0-rc.2, and latest RC supports an asynchronous gl prop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants