Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

OpenGL/GLUT for Mac OS X, packaged

5 views
Skip to first unread message

ja...@lazyatom.com

unread,
Apr 26, 2005, 7:43:07 AM4/26/05
to
I've just packaged up the latest revision of Yoshi's OpenGL/GLUT
bindings to work on the Mac. This has required a little bit of hackery
at extconf.rb and the .c files, but the result should compile following
the standard steps on an OSX box (works fine on my Powerbook,
certainly).

=== README.OSX ===

2005-04-26 :: James Adam <ja...@lazyatom.com>

Ruby-OpenGL Bindings for Mac OS X
=================================

So basically here's a tweaked version of the original OpenGL module for
the Mac. To compile, just follow the same instructions as normal:

Build it - don't worry too much about any warnings:
$ ruby extconf.rb
$ make

Test it out:
$ ruby sample/robot.rb
(press the 'e' and 's' keys to make the "robot" move...)

Install it:
$ make install
(or possibly "sudo make install", depending on where your ruby is)

Changes I've made
-----------------

extconf.rb:
Added -framework flags and correct include directories
Hacked to generate GLUT module even without detection of -lGLUT, since
mkmf can't deal with the Mac GLUT framework

*.c:
Edited #includes to use <OpenGL/gl.h> and <GLUT/glut.h>

glut.c:
I've added the function CheckLoop to the GLUT module in line with the
same function in Apple's GLUT. GLUT's MainLoop is blocking and forces
you to perform additoinal processing using GLUT's IdleFunc system,
which can sometimes be very undesirable (particularly if you are using
Ruby as the glue between two libraries which both feature this type of
loop). CheckLoop allows you to cycle through a *single* GLUT processing
loop, and then returns control to the calling thread/process. Thus, by
periodically calling CheckLoop, you can get the scene to update without
having GLUT seize control of the whole application.


Problems
--------

For some reason, including the libraries from the command line fails.
For instance:

$ irb
irb(main):001:0> require 'opengl'; require 'glut'
=> true

... works fine, but:

$ irb -r opengl
/usr/local/lib/ruby/site_ruby/1.8/powerpc-darwin8.0.0/opengl.bundle:
[BUG] Bus Error
ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0.0]

Abort trap

... clearly fails. Not sure about that.


=== EOF ===

Anyway, feel free to grab it at
http://www.lazyatom.com/software/opengl-0.32f.tar.gz and send me any
comments or fixes. One day I'll spend enough time learning about mkmf
to produce a proper patch so that the versions can be unified.

0 new messages