0

是否有在某处使用应用程序拥有的运行循环(使用 ownRunLoop=false)的示例?

当我基于 three.js 应用程序创建一个简单的示例时:

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)}

我收到以下错误:

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)

关于这个问题可能是什么的任何想法?

4

1 回答 1

2

您可能需要确保在调用 runPre/PostRender 之前调用了 onStart。

于 2019-01-23T18:19:56.153 回答