Ogre.rb : Ruby wrapper around Ogre

Welcome to Ogre.rb, the Ruby wrapper around the Ogre rendering engine. This currently is only known to build and run correctly on Linux, though I expect this will work just fine on Mac as well. Windows support will come later.

Ogre.rb is currently built for Ruby 1.8.5+ and Ogre 1.4.x (Eihort)

Usage

Assuming Ogre.rb and OIS.rb are compiled, you are free to copy lib/ogre.so and lib/OIS.so into your project as needed. You will need to either place the extensions next to the Ogre and OIS libraries or have your environment set up to know where these libraries are located. Then, using Ogre.rb is as easy as:

require ‘ogre’ require ‘ruby_ois’

and optionally

require ‘navi’ (note that navi is only supported in Windows using Direct3D at the moment) The samples/ directory is a direct port of the Ogre sample programs.

Contributing

Please post patches, feature requests, bug fixes to the rubyforge website at rubyforge.org/projects/ogrerb. As I’m not sure exactly how to unit test such a wrapper, it will be greatly appreciated if changes are proven as part of a sample application.

Build Requirements

* rake
* Ogre 1.4.x (Eihort)
* OIS
* swig 1.3.31+ (uses -autorename)
* pkg-config (Linux)

Build Steps

Linux

rake build_all

The resulting files can be found in ogrerb/lib.

Mac

TODO

Windows

Setup your environment

  1. Install Ruby One-Click Installer: rubyforge.org/projects/rubyinstaller/

  2. Install Visual Studio Express 2005: msdn.microsoft.com/vstudio/express/ (Be sure to register environment variables)

  3. You’ll need to remove the following 3 lines of the [ruby install dir]/lib/ruby/1.8/i386-mswin32/config.h file:

#if _MSC_VER != 1200 #error MSC version unmatch #endif

  1. You need the MS platform SDK available here(ish): www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en.

  2. Be sure to register environment variables in the setup.

  3. Download and install the Ogre SDK and the precompiled VC dependencies: www.ogre3d.org

  4. Set the environment variable OGRE_HOME to where the the Ogre SDK is installed

  5. Open “Visual Studio 2005 Command Prompt” and navigate to where you have Ogre.rb checked out and run the following rake tasks

Build

  1. rake ogre:swig

  2. rake ogre:compile

  3. rake ois:swig

  4. rake ois:compile

You cannot run rake ogre:build or ois:build due to a Windows file permission problem.

The resulting files can be found in ogrerb/lib.

Running Ogre.rb programs

You’ll either have to copy the OgreMain dll to the ogrerb/lib folder, or you’ll need to set the PATH (on Windows) or LD_LIBRARY_PATH (on Linux) environment variable to point to where this file is ([OgreSDK]/bin/release for prebuilt). Then, it’s simply require 'ogre' and off you go.