【发布时间】:2014-12-10 11:03:10
【问题描述】:
当我尝试将纹理应用到我的.dae 模型时,它没有被渲染并且控制台显示这个错误:
[.WebGLRenderingContext]GL ERROR :GL_INVALID_OPERATION :
glDrawElements: attempt to access out of range vertices in attribute 2
当我将以下代码添加到我的 collada loader 时会发生这种情况:
loader.load( 'models/walls.dae', function ( collada ) {
var colladaWalls = collada.scene.children[0]
colladaWalls.name = "walls";
var wallsTexture = new THREE.ImageUtils.loadTexture( 'textures/walls.jpg' );
wallsTexture.wrapS = wallsTexture.wrapT = THREE.RepeatWrapping;
wallsTexture.repeat.set( 2, 2 );
//adding the line below cause the model to not be loaded
colladaWalls.material = new THREE.MeshPhongMaterial( { map: wallsTexture, side: THREE.DoubleSide } );
colladaWalls.material.needsUpdate = true;
colladaWalls.material.wireframe = false;
colladaWalls.position.set(0,-2,0);//x,z,y- if you think in blender dimensions ;)
colladaWalls.scale.set(2,2,2);
scene.add( colladaWalls );
} );
问题:为什么?
【问题讨论】: