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

Re: [pygame] Using PyOpenGL for 2D graphics



Ian Mallett wrote:
Don't tell Silicon Graphics, but I've found pygame is much much faster at 2D.

That's rather surprising, assuming you have hardware acceleration.

It probably has to do with how you're sending the coordinates
to OpenGL. Making lots of calls to glVertex() from Python will
be inefficient, even more so than it would in C, due to the
slowness of Python function calls.

Putting your coordinates into an array and using one of the
array-oriented calls ought to be a lot better.

Another useful technique is to put frequently-used sequences
of operations into display lists, then you can invoke them
with just a single Python call.

--
Greg