Skip to content

Mesh Indexed

App: apps/mesh_indexed/

Draws a cube with indexed rendering: 8 vertices (one per corner), and a vertex map (index list) that defines 12 triangles (2 per face). This is the standard way to share vertices and avoid duplication.

Terminal window
% ./plume3d mesh_indexed

or

Terminal window
% ./../plume3d .
  • Graphics.newMesh([...], "triangles", _shader) — 8 vertices with position and color (e.g. front face 0–3, back face 4–7).
  • _mesh.setVertexMap([0, 1, 2, 0, 2, 3, ...]) — 36 indices for 12 triangles (front, back, right, left, top, bottom).
  • GraphicsloadShader, newMesh, drawMesh.
  • MeshsetVertexMap for the index buffer.