is it correct

when i try to invoke glDrawArray (in commentary) in a such case it work but if i try using glDrawElements it does not why???

toto = glGenLists(1);
glNewList(toto, GL_COMPILE);
glDrawElements(GL_TRIANGLES, indices.size(), GL_UNSIGNED_BYTE, indice);


First of all, your 2 calls aren’t necessarily the same.

Your glDrawArrays call will draw all the vertices from the vertex # indice[0], up through vertices indice[0] + indices.size() - 1.

Your DrawElements call will take vertex indice[0], indice[1], indice[2], …, indice[indice.size()-1]

Why isn’t this the same, you ask? Well… let’s say indice[0] = 10, indice[1] = 2, indice[2] = 5.

With glDrawArrays, you’ll be drawing vertex 10, 11, 12, 13, … , 10+indice.size() - 1

With glDrawElements, you’ll be drawing vertex 10, 2, 5, …, indice[indice.size()-1]