I'm just starting to learn OpenGL ES, but I'm having trouble understanding the workings of vertices and indexes. My real understanding is that the vertex is the point of the figure itself and that the indices are “triangles” at the vertex points. I am following a tutorial in which I define vertex points and indexes as shown below ...
Vertex data
-1.0f, -1.0f 1.0f, -1.0f -1.0f, 1.0f 1.0f, 1.0f
index data
0.3.1, 0.2.3
I understand that defining indices should always start from one vertex, but to me these numbers simply do not add up. When I draw this on paper, it looks like the drawn image should consist of two triangles that create the shape of a “crown”. Can someone explain why this actually draws a square instead of the “crown” that I expect?
Source code for the Square class:
public class Square { private FloatBuffer mFVertexBuffer; private ByteBuffer mColorBuffer; private ByteBuffer mIndexBuffer; public Square() {
}
Let me know if you need more information ...
Jason source share