我在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 )"
答案 0 :(得分:1)
使用非缩小版本或开发人员版本(three.js)以及库的最新版本进行调试。
此外,您不应该在程序中使用弃用的方法。尝试使用Vector3和Vector2而不是VERTEX或UV。
根据SecurityError,试试这个:
THREE.ImageUtils.crossOrigin = '';
var yourtxture = THREE.ImageUtils.loadTexture('your url or whatever')
或阅读这篇文章: