Baune said:

Thanks..I'm still not seeing the big picture though. The documentation says that somehow all idices should be bundles inside one array. But I can't see how this:

`// The indexes of Vertex/Normal/Color/TexCoord sets. Every 3 makes a triangle.`

int[] indexes={

0,1,2,1,2,3

};

Can describe anything else than the faces...unless vertex indices and texcoord indices always have the same value.

In that example from the wiki, there are two triangles.

Each index value corresponds to the index of the vertex/normal/texCoord arrays. So the first vertex rendered in that example uses the coordinates at vertexes[0], the normal vector at normals[0], texture coordinates at texCoords[0], and color values at colors[0]. And so on.

It can be a bit confusing at first, but it's really just telling us which bits of data to use. If you notice, all those buffers only have 4 elements, yet there are two triangles. In reality you should have 6 vertices, 6 normals, 6 texture coordinates. So data's re-used, and the indices tell us which.

Now if lets say you build a trimesh where you specify 6 vertices, 6 normals, 6 tex coords etc and the first three make the first triangle, and the second three make the second triangle. Then it's real simple, the index buffer would look like this:

0,1,2,3,4,5

Hope that clarifies...it's all about how your vertex, normals, texcoord, and color buffers line up and specifying the renderer that order. So if the first three vertices in your array make up a triangle, they better line up with the first three texcoords in your texcoord array, else you'll have mismatch and your rendered triangle will be messed up if the first three texcoords were meant for -another- triangle (like a triangle with vertices in the 3rd, 4th, and 5th spots in the vertex array).