Andrew Straw | 21 Dec 2007 02:42
Picon
Favicon

Re: pyglet vs. pygame

Hi Martin,

Certainly I agree that pyglet looks like a contender to replace pygame. 
I think that the multiple screen/window option is potentially a killer 
feature for us. My best guess is that it wouldn't be too much work to 
use it -- as far as I can tell, simply initializing the Screen instance 
using pyglet rather than pygame should be sufficient to test the water. 
Initially, I think we can probably keep using PyOpenGL (pyglet wraps 
OpenGL, too), although I'm certainly interested in some of pyglet's 
higher-level OpenGL texture management stuff -- if the VE used that, 
some of the Vision Egg's more hairy code could be eliminated. The pygame 
event handling would have to be ported, too, but I don't think that 
would be too hard.

I'm actually planning on poking around pyglet's code base a little more 
in the next week or so. I should have some more informed opinions then. 
I must admit that my immediate goal for pyglet is for another project 
(my wxglvideo module), but obviously anything I learn could be applied 
to VE. Nevertheless, I'm not planning on doing anything along with VE 
and pyglet in the immediate future simply due to time constraints.

If you want to attempt at a port, my best guess is that re-writing the 
Screen class to use pyglet rather than pygame should be 
just-about-sufficient to get a proof of concept done. (Also, 
swap_buffers will have to be done, but that's a one-liner, I guess.) 
Hopefully the multi-screen planning I did back in the early days of VE 
will make actually supporting multiple screens easy. You'd initially 
want to ignore the get_default_screen() stuff and just simply hand 
initialize screens with the values you know you want -- 99% of the stuff
in Screen is purely used at initialization and if it's missing, most of 
the rest of VE would never miss it. Doing things like creating 
reasonable default values and setting look up tables could be done later.

Keep us posted,
Andrew

Martin Spacek wrote:
> I recently stumbled across what sounds like a great replacement for pygame:
> 
> http://pyglet.org/
> 
> It's pure python (plus ctypes) and doesn't rely on SDL. It can easily 
> create multiple windows on multiple monitors, and works with OpenGL and 
> (apparently) PyOpenGL.
> 
> I see from some of the postings on pyglet's mailing list that Andrew 
> Straw already knows about it.
> 
> I'd like to be able to draw the same stimuli with visionegg to two 
> separate pyglet windows on two separate screens. Would it be hard to 
> modify visionegg's Viewport class to accept pyglet screens/displays in 
> place of pygame's SDL screen? I'd be willing to help out, but I'd need 
> guidance.
> 
> -- 
> Martin
> ======================================
> The Vision Egg mailing list
> Archives: http://www.freelists.org/archives/visionegg
> Website: http://www.visionegg.org/mailinglist.html

======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html

Gmane