For those interested the answer is that glDrawElements needs 2 array's, the vertex array and the index array. You pass the index array to glDrawElements not the vertex array
Code:
GLfloat vertexs[] = { 25.0, 25.0,
25.0, 75.0,
75.0, 75.0,
75.0, 25.0 };
GLubyte indices[] = { 0, 1, 2, 3 };
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_INDEX_ARRAY );
glIndexPointer( GL_UNSIGNED_BYTE, 0, indices );
glVertexPointer( 2, GL_FLOAT, 0, vertexs );
glDrawElements( GL_QUADS, 4, GL_UNSIGNED_BYTE, indices );
The index array specifies which order to use the vertices in so you could do
Code:
GLfloat vertexs[] = { 25.0, 25.0,
25.0, 75.0,
75.0, 75.0,
75.0, 25.0 };
GLubyte indices[] = { 1, 2, 3 };
glEnableClientState( GL_VERTEX_ARRAY );
glEnableClientState( GL_INDEX_ARRAY );
glIndexPointer( GL_UNSIGNED_BYTE, 0, indices );
glVertexPointer( 2, GL_FLOAT, 0, vertexs );
glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_BYTE, indices );
Which only uses 3 of the vertices and draws a triangle.