How to install OGRE SDK from source

screenshot_1

In this article we will present you how to install OGRE SDK, that so how to compile it from source. Even though we are aware that compiling is not recommended in Ubuntu, in this particular program is vital to do so. However, before we continue to the installation instructions, you need to know what OGRE is.

What’s OGRE

What is OGRE?

OGRE (Object-Oriented Graphics Rendering Engine) is a scene-oriented, flexible 3D engine written in C++ designed to make it easier and more intuitive for developers to produce applications utilising hardware-accelerated 3D graphics. The class library abstracts all the details of using the underlying system libraries like Direct3D and OpenGL and provides an interface based on world objects and other intuitive classes.

What can it do?

Lots of things! See the features page for an up-to-date list of the current features. Also, take a look at the screenshots page to see for yourself the kinds of eye candy OGRE can pump out.

Is OGRE a Game Engine?

No. OGRE can be (and indeed has been) used to make games, but OGRE is deliberately designed to provide just a world-class graphics solution; for other features like sound, networking, AI, collision, physics etc, you will need to integrate it with other libraries, something several frameworks have done, and we have a collision / physics reference integration library as an example in our distribution.

For more information click here.

1. Install Depedencies

As stated before, we are going to use the compile method instead of apt-get. Thus, you need you have installed all the necessary programs to do the job.

sudo apt-get install build-essential automake libtool

Next, you need to install the libraries required for OGRE. Compile-wise, you need the *.-dev packages. Type:

sudo apt-get install libfreetype6-dev libfreeimage-dev libzzip-dev libxrandr-dev libxaw7-dev freeglut3-dev libgl1-mesa-dev libglu1-mesa-dev libxt-dev libpng12-dev libglew1.6-dev

2. Download OGRE SDK Source

First off you need to understand what version you would like to install. Personally, as being a beginner to OGRE I recommend you to install the stable branch. Here’s a brief explanation of what there is available to the public.

Development (default) branch: this is the latest development version where all the new features are being added. This is fine if you want to see the very latest features, but it is inherently the least stable version, and there may be interface-breaking changes going on here. Only use the trunk if you are confident in your ability to handle the odd problem.

Maintenance branches: these are branches where the API is stable within a major version. Only bugfixes are applied to these branches, and no interface-breaking changes. Only one maintenance branch is actively maintained, representing the current stable version, but others may be present from previous stables. The maintenance branches are named after the stable major version, such as ‘v1-6′ or ‘v1-7′.  The latest of these is the best branch to use if you want to keep up with the latest fixes, but need a stable development platform.

Click on the button bellow to download OGRE’s Mainteance stable version from SourceForge.

SourceForgeOGRE SourceMerculiar

3. Compile OGRE SDK

Once you have extracted OGRE into /home dir, then go in that folder in terminal way. Pay attention that in the following example, I have downloaded OGRE 1.8.1 version, thus the name scheme applying is ogre_src_v1-8-1.

cd ogre_src_v1-8-1/

Create an empty directory, called “Build” and get inside:

mkdir Build
cd Build

Trigger cmake, passing path to Ogre source directory in order to create a regular makefile. Ogre uses cmake instead of ./configure:

cmake ..

Normally you can just run ‘make’ but if you have multiple cores, you can decrease your compile time by doing this:

make -j`getconf _NPROCESSORS_ONLN`

Once compilation is successful, you can install into the system (by default, /usr/local):

sudo make install

Otherwise, you can cmake and build OGRE using IDE, such as CodeBlocks, KDevelop or Eclipse. However, I like more using the terminal and gedit, rather than IDEs.

Code blocks is a well-known IDE for programming. If you want to build OGRE through Code::Blocks then setup your cmake parameters properly.

cmake -G “CodeBlocks – Unix Makefiles” ..

More information about Building project with Codeblocks can be found here.

Kdevelop4 is very nice, easy-to-use and modern IDE. After getting source, just open Kdevelop and click “Project -> Open/Import Project…” and show path to code (~/ogre_src_v1-8-1). You will have to choose build folder (eg /home/drpaneas/ogre_src_v1-8-1/build). Then wait a little bit for KDevelop to load and index the project files.

For building click on button “Build Selection”. For running click “Execute”. Running first time “Launch Configurations” will pop up. You have to set executable file by selecting “ogre_src_v1-8-1″, clicking “+” icon and choosing under (Launch Configuration) Executable “/home/drpaneas/ogre_src_v1-8-1/build/bin/SampleBrowser_d” as “Project Target”.Then Run it (Shift+F9).

More information here

Select “C/C++ / Makefile project with existing code” as project type. In “Existing code location”, click browse, and again,select openmw’s folder. Also select “Linux GCC” as toolchain, then click “Finish”.Now right-click on your project, and select “Properties”. Go to “C/C++ build”, uncheck “use default build command”, and specify your command, likemake -j 4 -C ${ProjDirPath}../build

In case you have problems with Eclipse, try to fix the includes (Eclipse complaining about Ogre and Bullet). Go to project properties, “C/C++ General”, “Paths and symbols”, select “GNU C++”.

Click the “add” button to add the following paths :

/usr/include/OGRE

/usr/include/bullet

 

More info here

Check this link right now

That’s it. Now you are able to launch the SampleBrowser, located at /Build/bin/ directory at your OGRE project.

When you launch SampleBrowser for the very first time, it asks you to choose your Renderer. Being in Linux and native in Ubuntu, you have no choice but select OpenGL Rendering Subsystem; then click Accept.

This is the menu of SampleBrowser. In there you can configure your settings and test any sample project that comes with OGRE SDK by default. Also, bare in mind that you are able to see the source code of any of these samples.

OGRE Wiki

SHARE THIS POST

  • Facebook
  • Twitter
  • Google Buzz
  • Reddit
  • Stumnleupon
  • Delicious
  • Digg
  • Technorati
  • Ultimoore

    Great “how to” build from source.

  • Hubix

    Finally! I was using a different engine for a few weeks only because I could not get Ogre running! Thanks

    • http://www.ubuntuxtream.com/ Panos Georgiadis

      Nice to know it works for you Hubix. Take care man.

  • http://www.facebook.com/xAlphaPlayerx Pol Gomez Riquelme

    It’s throwing me a bunch of warnings while ‘making’… do i have to worry about it? I’ve already installed all necessary things before compiling but i’m a bit scared. It’s also taking a while… hope it’s not a problem. Thanks for the guide!

    • http://www.ubuntuxtream.com/ Panos Georgiadis

      Hello Pol, yes there are many warnings but don’t be scared, there’s nothing to worry about. The time needed for compilation is based upon your CPU speed. Have fun and code graphics :)

      • http://www.facebook.com/xAlphaPlayerx Pol Gomez Riquelme

        Thanks a lot, it’s working flawlessly!