【问题标题】:three.js rendering issue with chrome - uncaught typeerrorchrome 的three.js 渲染问题 - 未捕获的类型错误
【发布时间】:2015-10-28 03:00:23
【问题描述】:

我在 firefox 上有一个可以工作的 three.js 程序,一切正常加载。当我尝试在 chrome 上运行该程序时,它会部分呈现背景和一些闪烁的对象。我检查了终端,它似乎吐出了与此问题相关的数千个错误--

    Uncaught TypeError: Cannot read property 'update' of undefined
THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.
THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.
THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.
THREE.UV has been DEPRECATED. Use THREE.Vector2 instead.
THREE.UV has been DEPRECATED. Use THREE.Vector2 instead.
THREE.UV has been DEPRECATED. Use THREE.Vector2 instead.

    THREE.WebGLRenderer 66
WebGL: INVALID_VALUE: uniform3fv: no array
WebGL: INVALID_VALUE: uniform3fv: no array
Uncaught SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': The cross-origin image at file:///C:/foodshop/images/wall-2.jpg may not be loaded.
WebGL: INVALID_VALUE: uniform3fv: no array
Uncaught SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': The cross-origin image at file:///C:/foodshop/images/wall-2.jpg may not be loaded.
WebGL: INVALID_VALUE: uniform3fv: no array
Uncaught SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': The cross-origin image at file:///C:/foodshop/images/wall-2.jpg may not be loaded.

由于它没有提供行号来定位错误的位置,我很困惑。我该如何解决这个问题?

编辑-------

我将我的three.min.js 的版本更改为最新版本,我不得不修改我的程序的几个方面,例如CubeGeometry 到BoxGeometry。

我现在的日志中有以下问题

"THREE.Projector has been moved to /examples/js/renderers/Projector.js."

还有几个。

"THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter. ( images/light.jpg )"

【问题讨论】:

  • 使用chrome.exe --allow-file-access-from-files启动浏览器

标签: three.js


【解决方案1】:

使用非缩小版或开发者版(three.js)以及库的最新版本进行调试。

此外,您不应在程序中使用已弃用的方法。尝试使用 Vector3 和 Vector2 而不是 VERTEX 或 UV。

根据SecurityError,试试这个:

THREE.ImageUtils.crossOrigin = '';
var yourtxture = THREE.ImageUtils.loadTexture('your url or whatever')

或阅读这篇文章:

Three.js and loading a cross-domain image

【讨论】:

  • 感谢您的提示。我解决了安全错误。然后我获取了最新的three.min.js 进行实验。从那以后,我一直在清理新的three.min.js中不存在原始构造函数的区域。例如,我必须将 CubeGeometry 更改为 BoxGeometry。但是现在我遇到了其他问题。我将在上面的编辑中详细说明这些内容。
  • @AMorton1989 在回答后不要更改问题。发一个新帖子。
猜你喜欢
  • 1970-01-01
  • 2014-05-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-11-09
相关资源
最近更新 更多