Ok so I\'m still struggling to get this to work. The important parts of my code are:
def __init__(self, vertices, normals, triangles):
self.bufferVertice
The reason why
glDrawElements(GL_TRIANGLES, len(self.triangles) , GL_UNSIGNED_SHORT, ADT.voidDataPointer(self.triangles))
works and
glDrawElements(GL_TRIANGLES, len(self.triangles) , GL_UNSIGNED_SHORT, 0)
doesn't is because PyOpenGL expects None
as the void pointer, rather than 0. Be careful when using OpenGL examples written in C, because they use (void*)0
as the void pointer, which isn't interpreted correctly as a pointer by PyOpenGL, which instead treats 0 as a non-void value.
Instead, you should use
glDrawElements(GL_TRIANGLES, len(self.triangles) , GL_UNSIGNED_SHORT, None)
(See also https://stackoverflow.com/a/14365737/478380)