Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript “使用”的问题;三、缓冲几何体();在最近的three.js(r71)中:场景中没有网格、GLDrawArray和VertexAttributePointer相关错误_Javascript_Three.js_Revision History - Fatal编程技术网

Javascript “使用”的问题;三、缓冲几何体();在最近的three.js(r71)中:场景中没有网格、GLDrawArray和VertexAttributePointer相关错误

Javascript “使用”的问题;三、缓冲几何体();在最近的three.js(r71)中:场景中没有网格、GLDrawArray和VertexAttributePointer相关错误,javascript,three.js,revision-history,Javascript,Three.js,Revision History,我尝试了网站上的例子,效果很好。但是,他们使用了three.js的第63个版本。当我使用three.js的第71版时,网格不会出现在场景中,console会输出如下错误: three_r71.js:20261 WebGL: INVALID_OPERATION: vertexAttribPointer: no bound ARRAY_BUFFER 5index.html:1 [.WebGLRenderingContext-05EBE9A0]GL ERROR :GL_INVALID_OPERATIO

我尝试了网站上的例子,效果很好。但是,他们使用了three.js的第63个版本。当我使用three.js的第71版时,网格不会出现在场景中,console会输出如下错误:

three_r71.js:20261 WebGL: INVALID_OPERATION: vertexAttribPointer: no bound ARRAY_BUFFER
5index.html:1 [.WebGLRenderingContext-05EBE9A0]GL ERROR :GL_INVALID_OPERATION : glDrawArrays: attempt to access out of range vertices in attribute 0
导致问题的简化和提取代码:

function create_geometry (scene) {

      var material;
      var geometry;
         geometry = new THREE.BufferGeometry();
         geometry.attributes = {
         position: {
            itemSize: 3,
            array: new Float32Array([
            38.584, 3086.240, -1251.993,
            38.584, 2854.030, -665.175,
            -41.416, 2854.030, -665.175,
             38.584, 2251.488, -505.608
            ])
         },
         normal: {
            itemSize: 3,
            array: new Float32Array([
            0.000, -0.930, -0.368,
            0.000, -0.930, -0.368,
            38.584, 1726.241, -311.993,
            1.000, 0.000, 0.000
            ])
         },
         uv: {
            itemSize: 2,
            array: new Float32Array([
               0.624, 0.344,
               0.085, 0.380,
               0.085, 0.656,
               0.624, 0.344
            ])
         }
         };
         material = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
         var mesh = new THREE.Mesh(geometry, material);
         scene.add(mesh);
}
添加“geometry.computeTangents();”无法解决任何问题

哪些升级导致了该错误?如何使用three.js(r71)避免它