Suppose you have a 2D rectangle of size [2, 2].
These are the vertices it uses:
While we only need four vertices to represent this rectangle, the graphics cards wants triangles, each one having three vertices.
So if we were to split the above rectangle into triangles, we would need to send six coordinates instead of four.
Another way to do this, is send only those four vertices, but together with them also tell the graphics card how to form triangles from them.
This is where the index (element in OpenGL) buffer comes in.
The element buffer has numbers that index your vertices.
E.g. 0 would be the first vertex, 1 the second, and so on.
So with an element buffer, to form the triangles needed for the rectangle, we need to send these indices: [0, 1, 2, 0, 2, 3]. If you replace the numbers with the actual vertices they index, you will see you get the original six vertices to form the triangles.
Indexing reduces memory and bandwidth (except for very uncommon worst case scenarios), which in turn help rendering speed.
Most file formats (to which you export from Blender, 3ds Max, etc.) support indexing, but there are two variants of indexing for file formats.
In modeling tools (and in fact, in your OpenGL code too!), a "vertex" isn't a position, it's a combination of a position, a normal vector, a color, a texture coordinate, and so on.
Every one of these things is called a vertex attribute, and is only one part of the whole vertex.
OpenGL (and Direct3D) only allow 1D indexing, or in other words - you have one index that points to all the vertex attributes.
For example, if you have an array of vertex positions and another array of vertex normals, then index 0 would be the first position and the first normal.
This might seem obvious, but some file formats don't actually store their data this way.
In most cases, a model doesn't actually need the same amount of positions, normals, and so on.
If there are many vertices that have the same normal, the file might store only one normal, and let them all share it.
You then have different indices for each vertex attribute, which you can't directly use for rendering.
In this case, you will have to "flatten" the arrays and fill them up with all the shared data.
This can be seen in the completely obsolete, bad format *.OBJ (it's the most terrible format in existence, but for some reason it's used everywhere).
Edited by Chananya Freiman, 12 July 2013 - 06:43 AM.