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

[pygame] Speed up image.tostring with OpenGL ?



Hello Pygame users and developers !

Is there a way I can speed up the transfert from a surface to an
OpenGL texture ? Right now, I use the pygame.image.tostring function,
but it seems like converting the pixels to a Python str creates a
serious bottle neck in my stop motion application...

I think that it should either be implemented directly in Pygame, (best
option) or done using something like ctypes in my application. If none
of these option is not easy enough, I am thinking about switching to
Gstreamer+GTK with the GdkPixBuf, instead of Pygame surfaces. An other
option would be to rewrite the whole application in C++...

Any suggestion to fix this in a way that is not too long ?
My frame rate drops to 4 FPS when there are more than a few surfaces in my list.
Please try Toonloop to test this out. It works well on Linux. If
someone get it to work on Mac or Windows, I would need hints for
packaging it for those OS too. I convert the surfaces to OpenGL
texture in texture_from_image from the file
http://bitbucket.org/aalex/toonloop1/src/tip/toon/draw.py on what is
currently the line 42.
--
Alexandre Quessy
http://alexandre.quessy.net/