Choosing Between Pygame and GLUT - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Programming Languages & Scripting (/forum-8.html)
+--- Thread: Choosing Between Pygame and GLUT (/thread-3953.html)
Choosing Between Pygame and GLUT - doucette - Aug 24, 2006 02:56 PM
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?
- Chris Doucette
Choosing Between Pygame and GLUT - OneSadCookie - Aug 24, 2006 03:17 PM
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).
Choosing Between Pygame and GLUT - lightbringer - Aug 24, 2006 03:29 PM
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.
Choosing Between Pygame and GLUT - Skorche - Aug 24, 2006 05:58 PM
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.
Choosing Between Pygame and GLUT - lightbringer - Aug 24, 2006 06:00 PM
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.
Choosing Between Pygame and GLUT - doucette - Aug 24, 2006 06:31 PM
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?
Choosing Between Pygame and GLUT - OneSadCookie - Aug 24, 2006 06:50 PM
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.