I recently started to learn OpenGL through Python thanks to several tutorial (especially the Nicolas P. Rougier one: http://www.labri.fr/perso/nrougier/teaching/opengl/).
<gl.glDrawElements(gl.GL_TRIANGLES, len(index), gl.GL_UNSIGNED_INT, index)
The index argument has two different meanings depending on whether an ELEMENT_ARRAY_BUFFER
is bound or not:
ELEMENT_ARRAY_BUFFER
is bound, then the index parameter specifies an offset into this buffer. This defines where in the buffer the indices start.In your case, a buffer is bound, so you tell OpenGL to start somewhere in the buffer. But what you want is to start at the beginning of the buffer, thus you have to set index to 0.
gl.glDrawElements(gl.GL_TRIANGLES, len(index), gl.GL_UNSIGNED_INT, ctypes.c_void_p(0))