Ruby Gems and OpenGL

Posts: 23
Joined: 2006.12
Post: #1
I've been using Ruby with the rubysdl and ruby-opengl gems on one of my pcs to work on a 2D game. This has work splendidly and has given me a chance to use ruby. Something I'm quite enjoying.

My mac however, is having quite a hard time using the two gems in question. I used 'gem install -y' to install both packages, no errors were reported. But when any of my ruby scripts attempt: require 'sdl' or require 'opengl' I just get a file not found error.

Is there a step I'm missing? I have a sneaking suspicion it has something to do with a mix-up between the default ruby installation and my fresh ruby installation.

(And on an unrelated note, is rubysdl such an odd thing to be using on osx? All my google searches return few english pages.)
Quote this message in a reply
Posts: 5,143
Joined: 2002.04
Post: #2
I used RubySDL for a while until I made RubyGameShell. I'm also working on a new set of OpenGL bindings: GLEWby. It's OK for the basics, but pointer and array handling is still a bit dodgy.

I'm afraid I don't know anything about the gem situation, however -- when I was using those things was long before rubygems existed.
Quote this message in a reply
Posts: 23
Joined: 2006.12
Post: #3
Yeah, I had looked into your gameshell previously, but as cross-platform is an absolute requirement for me, I wasn't able to use it.

To be polite to anyone who has a similar problem, I'll do a quick run down of how I fixed this.

First, I used fink to reinstall ruby and all of it's dependencies. From Fink, I was also able to install ruby-opengl along with it's dependencies. Ruby/SDL was not available through Fink so I had to install that from source. The usual configure-make-install. I then discovered a little catch about Ruby/SDL on osx. Using the 'ruby' command to run your script will not work. You have to install a separate tool called rsdl.

Funny thing about that, the guy who made the tool no longer hosts it. It can however be grabbed from this site: It's a small tool that only links in some extra libraries needed on osx.

Also, the configuration script that comes with RSDL didn't work for me. I had to use the following command I found on the rubygame mailing list:

gcc rsdl.c -I/usr/local/include/SDL -I/sw/lib/ruby/1.8/powerpc-darwin/ `sdl-config --cflags` `sdl-config --libs` -lruby -o rsdl

That then gets dropped in usr/local/bin and tadaa, ruby/sdl now works. Of course, you have to use the 'rsdl' command to rub your scripts instead of 'ruby.'

I hope this eventually helps someone else.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Ruby on Rails setting Time to NULL BeyondCloister 3 5,662 Nov 21, 2007 09:56 AM
Last Post: AndyKorth
  Ruby, MacPorts, Firewalls BeyondCloister 3 5,991 Nov 6, 2007 04:57 PM
Last Post: OneSadCookie
  Ruby: Resources for Learning iefan 10 10,091 Jul 4, 2007 08:54 AM
Last Post: ALX99066
  Embedding Ruby DesertPenguin 3 4,868 Jan 5, 2007 09:11 PM
Last Post: DesertPenguin
  probably a dumb question about ruby extensions... Duane 3 4,117 Jun 26, 2006 12:33 PM
Last Post: Duane