[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Python - Pygame - PyOpenGL performance



I spent a good portion of this evening updating my glSprite class to use VBOs to render. I was able to push 1800 individually animated, arbitrarily sized sprites at 60FPS before my CPU tapped out. That's more than 3 times faster than the display lists.

I've done some performance analysis on my code and found that the largest bottleneck by far is iterating through my game objects and populating the NumPy array that gets streamed off to the GPU (I've already made sure that I never duplicate, copy or type convert the array at any time.). The actual streaming and draw calls are negligible by comparison. I tried hard-coding the arrays to see just how much CPU the streaming and drawing took, but I was never able to get it past 20%, no matter how many quads I told it to draw.

So I guess I'll continue looking for ways to keep pushing that array population faster. It looks like I've gotten the OpenGL side of things running as quickly as technically possible. Thanks everyone for the nudges in the right direction.

-Zack


On Feb 26, 2009, at 3:06 PM, Ian Mallett wrote:

There are certain easy ways to optimize certain techniques.

For example, I wanted an OpenGL program with many many particles.
They had only to be one color, and should be pretty small.  The
solution was to use shaders to draw points.  I got over one million
(1024**2) particles at 50fps using this technique.  Still, the
solutution ended up being pretty complicated.

I'm guessing that for better results, you'll likewise want something
more complex.  There's not really a way around it.  Display lists are
the easiest method I've seen for drastically improving performance.
If you want faster, you'll need more code.

Ian