google-ar / codelab-webxr

Building an augmented reality application with the WebXR Device API
https://codelabs.developers.google.com/codelabs/ar-with-webxr/
Apache License 2.0
171 stars 85 forks source link

Uncaught (in promise) TypeError: this.gl.setCompatibleXRDevice is not a function #18

Open MannyMeadows opened 5 years ago

MannyMeadows commented 5 years ago

Having successfully run the codelab examples yesterday, I've found that after today's Canary update I'm getting the above error on my S8 running Canary 73.0.3665.4 and Android 8.

The result is that the grey background and GIF remains while the camera feed is missing.

dozenit commented 5 years ago

Same thing on my Pixel XL (Android 9; Canary 73.03665.2)

TheWebGLRenderingContext appears to have changed. The method setCompatibleXRDevice was used for checking device compatibility. The WebXR Device API draft has been updated just recently, so I assume a structural change has to do with it.

chrome_2019-01-09_webglrenderingcontext_unknownfunction

This happens in line 132 in app.js:

this.gl = this.renderer.getContext();

// Ensure that the context we want to write to is compatible // with our XRDevice await **this.gl.setCompatibleXRDevice**(this.session.device);

Regarding Chromium, there are currently two issues about this function name; but they're both from August last year.

I have yet to find out how to properly get the XR device now. Any ideas? (My guess would be that it might be done using the XR object instead, which is meant to be the entry point to the API, so this could avoid having to touch the GL context directly.)

The proposal entry for this method in the Immersive Web Github Repo is even older.

(It seems to have been like that for a long time now, as those lines of code above have also been used on some of the older webxr-examples from March 2018.)

jsantell commented 5 years ago

Looks like this function was changed to makeXRCompatible

krzysioks commented 5 years ago

Hi, after following jsantell's comment I have changed call of setCompatibleXRDevice to makeXRCompatible. This solved the original issue, but new one has arised:

Uncaught (in promise) TypeError: this.session.requestFrameOfReference is not a function at App.onSessionStarted

In the WebXR Device API draft: https://immersive-web.github.io/webxr/#dom-webglrenderingcontextbase-makexrcompatible there is no more reference to requestFrameOfReference. Might this function been changed also?

jsantell commented 5 years ago

There's been a few changes in Canary so the implementation is inbetween documented specs, so a bit hard to follow unfortunately. Check out these changes we've landed in model-viewer, it's mostly cosmetic name changes -- FYI this will be happening over the next few months, so the platform is still quite unstable.

Issues: