Geometries on vertex of BufferGeometry in Three.js
<p>I thought I wanted a quiet simple thing, but it turned out to be more complicated then I expected..</p>

<p>All I want are meshes on every vertex of a <code>THREE.BufferGeometry</code> (a sphere)!</p>

<p>CODEPEN: codepen.io/cheesyeyes/pen/YwBZGz</p>

<p><a href="http://i.stack.imgur.com/zVc9A.png" rel="nofollow">this is what I want to have</a></p>

<p>This is my buffer geometry:</p>

<pre><code>var bufferGeometry = new THREE.SphereBufferGeometry(1,1,1);
</code></pre>

<p>I'm trying to get the vertex's positions:</p>

<pre><code>bufferGeometry.getAttribute('position',0);
</code></pre>

<p>so how do I read them out correctly so I get the positions of all (here 5) vertex of my bufferGeometry?</p>

<p>I tried it like this. It actually works, but its very ugly I think:</p>

<pre><code>vertexMesh.position.x=position.array[0];
vertexMesh.position.y=position.array[1];
vertexMesh.position.z=position.array[2];

for(i=12;i&lt;position.array.length-9;i=i+3)
            { 

            //vertexGeometry
            var vertexGeometry = new THREE.SphereGeometry(0.1,32,32);

            var vertexMaterial = new THREE.MeshBasicMaterial({color:0xff0000});   

            var vertexMesh = new THREE.Mesh(vertexGeometry,vertexMaterial);    

            vertexMesh.position.x=position.array[i];
            vertexMesh.position.y=position.array[i+1];
            vertexMesh.position.z=position.array[i+2]; 

             scene.add(vertexMesh);

            }
</code></pre>

<p>I simply don't get how this array is arranged.. please help me out!
Thanks!</p>