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

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



Kris Schnee wrote:

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.



I use Display Lists for just about everything, and they greatly speed drawing; without them my game would be infeasible in pygame. I'm doing something fairly similar to what you describe, using a textured quad for each hex in a gameboard, all of which are drawn in one display list. The soldiers are drawn in their own display lists, so they can move indpendently of the board.
http://img374.imageshack.us/img374/4086/0824160601screen0mc.jpg


It helps to understand that "Display List" is a bit of a misnomer -- they can store and optimize any set of openGL commands, i.e. there's no restriction on what you can store, nor any need to store everything together in one list. Object geometry can be seperate from object transformation can be seperate from texture/color can be seperate from scene transformation/projection

From what you describe, I would guess it'd help if you used one display list for your landscape, comprised of just geometry, texture/color and where things go. Then you can "spin the landscape" by transforming your projection matrix (i.e. point of view) outside of that (no need for a display list as it's done infrequently).

-Jasper