0

Is there an example that uses an app owned run loop (using ownRunLoop=false) somewhere?

When I create a trivial example based on the three.js app:

const onxrloaded = () => {
  const canvas = document.getElementById('camerafeed')
  // Open the camera and start running the camera run loop.
  XR.run({canvas, ownRunLoop:false})

    function render() {
        XR.runPreRender(Date.now());
        XR.runPostRender(Date.now());
    }
    function animate() {
        requestAnimationFrame( animate );
        render();
    }
    animate();
}
window.onload = () => {window.XR ? onxrloaded() : window.addEventListener('xrloaded', onxrloaded)}

I get the following error:

xrweb.js:3 Uncaught TypeError: Cannot read property '_c8EmAsm_flushTrace' of undefined
    at Object.V [as runPreRender] (VM737 xrweb.js:3)
    at render (index.js:121)
    at animate (index.js:126)
    at onxrloaded (index.js:128)
    at window.onload (index.js:131)

Any thoughts on what the issue could be?

griffin2000
  • 709
  • 9
  • 26

1 Answers1

2

You might want to make sure that onStart has been called before calling runPre/PostRender.