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 genuine 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" isnt a position, its 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 definite, but some file formats dont actually store their data this way.
In most cases, a model doesnt 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 cant 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 (its the most terrible format in existence, but for some justification its used everywhere).
Edited by Chananya Freiman, 12 July 2013 - 06:43 AM.