05 Data becomes vertices
Index array → triangles
Indices tell the GPU which three points make a face; two triangles make a square.
Exercise
Drag numbers, or edit the code
// JS - three indices make one triangleindices = [ 0, 1, 2, 0, 2, 3];
Three.jsnew THREE.BoxGeometry() stores exactly these two arrays2 triangles make a face; 12 make a cube.
JS side
gl.uniformMatrix4fv(uModel, …) // rotation -0.55 / 0.35An index array joins points into triangles by number; 12 triangles make a cube. That is exactly what Three.js’s BoxGeometry stores.
Try it
- Turn the cube and find the triangle made of p0, p1 and p2