I recently build a obj file loader in python 3 using pygame and pyopengl. It works perfectly fine, but when I load a round object it starts running realy slow. I'd like to load multiple complex objects at a decent framerate, but this aproach wouldn't be suitable for that. Do you have any recommendations for writing the code more efficently, exchanging pygame/pyopengl for something different or (if none of the above work) maybee downsample the object? (important parts of the code are below)
# verticies is a list of all verticies
# surfaces holds tuples of indexes of verticies
def body():
glBegin(GL_TRIANGLES)
for surface in surfaces:
for vertex in surface:
glVertex3fv(vertices[vertex])
glEnd()
pygame.init()
size = (800,600)
pygame.display.set_mode(size, DOUBLEBUF|OPENGL)
while True:
body()