powered by text files


PyGame on Mac OS X with PyOpenGL

As a result of Richard Jones’s talk at OSDC2005, I decided to install PyGame to play around with.

The demos in the talk were slick, even to the point where PyGame was used as the presentation tool. Much more dynamic than PowerPoint.

Unfortunately, install is where a bit of trouble started. There didn’t seem to be a simple explanation as to how to get it functioning on my Mac. The presentation was great, and on a Mac…

Must be possible!

As with most of these things, the joy is in going down blind alleys, banging your head against (several) walls and making discoveries. The only way to truly learn something. Unfortunately, the pain can’t be totally avoided. Without it, there were no mistakes. No mistakes lead to no need to learn. Or so I kept telling myself.

After several rounds with the wall at the end of the alley, some libraries I built. Some refused to build. Some I later discovered binary packages for.

I’ve included a bunch of links below that point to the required packages. It should be relatively easy to grab everything and have a working PyGame installation.

  1. Python 2.4
  2. PyObjC
  3. Python Numeric
  4. Python Image Library (PIL)
  5. SDL - C library for user handling
  6. [SDL_ttf][] - C library for TrueType fonts
  7. [SDL_image][] - C library for image handling
  8. [SDL_mixer][] - C library for sound
  9. SMPEG - C based Mpeg and MP3 library. (Checkout smpeg from CVS; autoconf; automake; ./configure; make; create framework.)
  10. PyGame
  11. PySDL is now in PyGame - Python binding for SDL

Optional packages:

  1. PyOpenGL - OpenGL bindings for Python
  2. FreeType - TrueType font library, listed as a dependency of SDL_ttf but I have no issues without it (yet?).

If it helps, my /Library/Frameworks looks like:

$ ls -d [Ss][^t]* Python.framework
Python.framework/       SDL_mixer.framework/
SDL.framework/          SDL_ttf.framework/
SDL_image.framework/    smpeg.framework/

Useful things are now available in /Developer/Python/pygame, with /Developer/Python/pygame/Examples providing a bunch of examples to test your installation.

A very big grin spread over my face watching the cube rotate from typing:

$ python /Developer/Python/pygame/Examples/