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

Re: [pygame] is fast opengl a possibility in pygame?



Sami Hangaslammi wrote:
On 8/24/05, Drewcore <drewsph@xxxxxxxxx> wrote:

is creating a playable game (speed-wise) a possibility with
pygame and pyopengl?

Absolutely. It's just that function calls have such a high overhead in Python, that you have to minimize the frequency and number of OpenGL calls you do from your code. This is pretty easily achieved by liberal use of opengl display lists and vertex/color/texture-arrays. With display lists, you can render a complex scene with a single function call (glCallList), so the overhead of Python stays minimal.

I've played with display lists and had trouble with them. It seems that any variables the list descriptions use are fixed at that time, so that if a list uses "player.position.x" and it changes, the position to which the player is drawn doesn't change.


I've got cube-drawing code that builds a 3D landscape out of variable-height pillars, at some distance from the camera, with some tilt. This is done by translating "into" the screen, then tilting, then drawing relative to that axis. If I try to spin the landscape, nothing seems to happen if I'm using lists. What am I missing about "vertex/color/texture-arrays?" To the extent that I got lists working, they didn't seem to improve FPS by more than 1-2 anyway, when I expected massive gains.

Lists would probably help a lot if I had them working well; my landscape demo runs at 193 FPS with nothing drawn, 28 FPS with just a few "widgets," and 13 FPS with widgets and cubes.

Kris