Indices
You may have noticed that we need to render each triangle with a new set of vertices, which can lead to a lot of vertices sitting in exactly the same place. This is fairly inefficient at high triangle counts, and takes up a lot of memory, especially when you have multiple blocks of information stored within a vertex. We can get around this using a concept similar to array indexing. We will start by providing an array of vertices to the GPU; however, instead of defining the order to draw the triangles in the same array, we just provide single vertex entries for each point.
The GPU then uses this alongside an array of indices to define the layout of the triangles. We will save a lot of memory by defining each point by a single integer rather than a full vertex for each triangle corner.
If we want to draw the given quad without an index buffer, we will need the following:
Vec3(0, 0, 0) Vec3(1, 0, 0) Vec3(0, 1, 0) Vec3(0, 1, 0) Vec3(1, 0, 0) Vec3(1, 1, 0)
Now if we use...