On 24/09/2007, at 1:11 AM, Jim Storch wrote:

>
> Hey everyone,
>
> I am really enjoying working with Pyglet.  I love the minimal
> dependency approach.  One problem I've run into though is slow image
> blitting.  When I run the code below that performs 100 blits of the
> same 64x64 png image I get about 19 frames per second.

Like Richard suggests, you're going to have to optimise at the OpenGL  
level.  Thankfully the results can be worth the effort.

Before trying anything else, try running with python -O, which  
disables the GL error checking and is usually at least twice as fast.

You'll find that in general the bottleneck is either in the Python  
interpreter or the ctypes function call overhead (one for every GL  
call).  The idea, then, is to minimise the number of GL calls;  
typically by batching operations, sorting state changes and so on.

If you're new to GL you may find the simplest optimisation is to wrap  
the img.blit() call in a display list, then glTranslate and  
glCallList to blit the sprites.

You'll get the best performance by drawing a single vertex array as  
point sprites (delta-v http://www.partiallydisassembled.net/deltav/  
does this to draw its particles).  If you're only moving a subset of  
the sprites each frame, you could probably improve things by using a  
vertex buffer object.

Good luck
Alex

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to