For glut:
The main goal is having ruby installed and being capable of compiling native C extensions for ruby (ruby-dev), as well as having the required OpenGL libraries.
On Ubuntu or Debian systems, aside from Ruby you’ll need the ‘developer’ package
ruby-dev, which supports compiling C extensions for ruby.
For OpenGL related headers you’ll need the following packages:
libgl1-mesa-dri libgl1-mesa-dev – opengllibglu1-mesa libglu1-mesa-dev – glufreeglut3 freeglut3-dev – (free)glutOn some distributions you may need the xorg-dev developer package.
h4. ArchLinux
$ pacman -S mesa glu freeglut
On OS X, you will need to install your own version of Ruby as the version that ships with OS X has known problems with properly building ruby-opengl bindings. You’ll also need XCode for gcc and tools.
For manual build on Windows you need to have platform SDK and compiler that must match the one which was used for compiling ruby binary (for One-click ruby installer it is MSVC 6.0).
If ruby was installed via the one-click installer, the DevKit is also needed (for compiling native C extensions).
opengl should support being installed via gems now. Just do
gem install opengl and it should pull down the gem
and try to build the bindings for you automatically.
For windows there is also pre-built binary windows gem available (i386-mswin32) which is compatible with the ruby one-click installer and does not need compiler or other mentioned tools installed.
gem install rakerake in the root directory of the projectrake test to run unit tests to verify it works properlyrake clean to clean out the projectrake gem to create source gem from projectgem install pkg/ruby-opengl-(version).gem to compile and install the gemrake binary_gemTo run unit tests:
$ rake test
Note that the tests have the adverse effect of testing the underlying OpenGL implementation, so depending on your GL provider, drivers or OS, the tests may fail, crash, or not run at all, without affecting your ability to use the bindings.
To run a sample file, make sure the ruby-opengl gem is installed then:
$ cd examples
$ ruby -rubygems plane.rb