Running OpenGL on Mac OS X

I couldn’t see any info describing this process on the web, so i’m
posting it here, feel free to copy it into any wikis or how-tos or
anything.

You’ll need X11 installed (I’ve used the apple packages, make sure you
install the user & SDK packages), plus the ‘glut’ package from fink
(http://www.fink.sourceforge.net). I’m also assuming that fink puts
its files into /sw (that’s the default). Download the opengl package
from the RAA and extract it.

  1. run ‘ruby extconf.rb’ to generate the makefiles

  2. edit Makefile.glut:

    • add “-I/sw/include” to CPPFLAGS
    • add “-L/sw/lib” to DLDFLAGS
    • replace “libruby.a” with “-lruby” in LIBS
  3. edit Makefule.ogl:

    • replace “libruby.a” with “-lruby” in LIBS
  4. run ‘make’ - it should now compile fine, you’ll get some parse
    errors probably, and something about glutKeyboard that always seems to
    appear - don’t worry about it.

  5. run ‘sudo make install’ to install the library

You should now be able to run the samples. Don’t forget to either run
ruby from the X11 xterm, or have X11 running and your DISPLAY variable
setup in the Mac OS Terminal (i.e. ’ setenv DISPLAY “:0.0” ')

More on how to integrate this with FXRuby as i figure it out.

[Background info: I’m running 10.2.3, DevTools from Dec 2002, Fink
installed into /sw, rbogl-0.32b.tgz, ruby 1.6.8 (stable) compiled from
source]