Choosing Between Pygame and GLUT

doucette
Unregistered
 
Post: #1
Hello all -

It's been a very long time since I last interacted with iDG - so long that I can't even remember the username I used to have, which has probably been deleted by now anyway. But on the brighter side, I have much more of a clue than I did back in high school.

I've started using Python for all my game programming, and I'm loving it. I have so far been using Pygame for things like input handling and FPS control, but pyOpenGL on the graphics side. I've been looking through the pyOpenGL GLUT documentation and wondering whether there would be any advantage to using GLUT's event handling system, i.e. registering a callback function for all mouse and keyboard events, instead of processing Pygame's event queue each frame, which has worked fine for me so far.

My inclination is to not fix what ain't broke, but I'm also somewhat interested in the pop-up functionality GLUT offers, as I'm in the middle of building a level editor for my game. In short, is there anything I'd be losing by switching from pygame to GLUT for window management and input handling?

Thanks,
- Chris Doucette
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
GLUT doesn't handle key events very well (particularly modifiers like control), doesn't handle full-screen very well (no way to find what resolutions are available), forces you to use its peculiar preferences dialog, etc.

You want to stick with the standard SDL-based window & events, if they're already working for you.

(Under the hood, it's all Cocoa, so there's no efficiency concerns here).
Quote this message in a reply
Member
Posts: 144
Joined: 2004.07
Post: #3
Sweet, it's good to hear pygame come up on these boards as it's an excellent environment for any game developer. I've brought myself up to speed on python over the past few days and hopefully I'll soon be able to write a little 2D game in pygame (I'm so used to rolling my own engine that using pygame will be a nice change).

Pygame was originally called pySDL, because it was simply a python wrapper for SDL - of course pygame now offers more (using SDL_ttf and SDL_mixer for fonts and sounds, MPEG playback with ffmpeg, plus many modules to help you do a wealth of other interesting things). So you can think about this as SDL vs GLUT. EDIT: and OneSadCookie compared them nicely above.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #4
lightbringer Wrote:(I'm so used to rolling my own engine that using pygame will be a nice change).

You're still going to need to write an 'engine'. PyGame is only SDL after all.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 144
Joined: 2004.07
Post: #5
Skorche Wrote:You're still going to need to write an 'engine'. PyGame is only SDL after all.

I meant elements of an engine (IE the individual components that provide all that functionality), and much has been done by the community. Pygame isn't just vanilla SDL, after all.
Quote this message in a reply
doucette
Unregistered
 
Post: #6
I actually don't use anything from Pygame itself for graphics; I wrote my own 2D sprite "engine" using pyOpenGL. I know it's reinventing the wheel, but it was to learn OpenGL as much as anything, and also because I wanted to be able to play around with 3D effects later on.

Anyway, thanks for the advice on SDL vs. GLUT. I would rather stick with the infrastructure I've already got working. One thing that is unfortunately missing from Pygame, though, is any way of interacting with the menubar, and it's not intuitive how to make it play nicely with a separate Python GUI package like wxWidgets; any suggestions on that front?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #7
You can probably use Py2App from the PyObjC project to make a proper bundled Mac application, and you should be able to use Cocoa via PyObjC to make any GUI you want.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  pygame or lingo? hertzcastle 6 4,312 Mar 19, 2008 01:13 AM
Last Post: hertzcastle
  pygame framework foosh 0 2,297 Feb 29, 2008 02:09 AM
Last Post: foosh
  So... anyone doing any stuff in Python/Pygame...? Malarkey 12 6,542 Aug 23, 2007 12:09 PM
Last Post: Malarkey
  Animation help in pygame suplexx 3 3,702 Mar 13, 2007 01:51 PM
Last Post: suplexx
  Python and Pygame. bronxbomber92 10 4,769 Dec 31, 2006 11:00 AM
Last Post: bronxbomber92