Jump to: navigation, search

Programmation:Compiler Ogre3D sous linux

(Redirected from Compiler Ogre3D sous linux)

Tested with:

  • Hardware: Intel i7, NVidia GTX 980
  • OS: Linux Mint 17.3 64bits

Getting the source

Installation of TortoiseHG

$ sudo apt-get install tortoisehg

Getting source code from bitbucket.

After cloning the repository locally:

Ogre - TortoiseHg Workbench 625.png


Obviously, Ogre needs a lot of things. complete tuto.

$ sudo apt-get install build-essential automake libtool libfreetype6-dev libfreeimage-dev libzzip-dev libxrandr-dev libxaw7-dev freeglut3-dev libgl1-mesa-dev libglu1-mesa-dev nvidia-cg-toolkit libois-dev libboost-thread-dev doxygen graphviz libcppunit-dev

Compiling engine

This step will take several minutes. I recommend using CMake with UI.

$ sudo apt-get install cmake-qt-gui

Create a build folder somewhere.

$ mkdir ~/ogre_build/

Open CMake-QT and configure it. full tuto here

  • source: folder containing the main CMakeList.txt
  • build: compilation folder

CMake - -ogre build 001.png

hit Configure

CMake - -ogre build 002.png

hit Generate

The build folder should now contains a Makefile at the root.

$ cd ~/ogre_build/
$ make
$ sudo make install

The make process is long.

Empty example

Create a ogre_example folder. I'm working in a folder named forge.ogre.

$ cd ~/forge.ogre/
$ mkdir ogre_example

Create 2 subfolders, one for source, the other to build.

$ cd ogre_example
$ mkdir ogreapp
$ mkdir ogreapp_build

Get the clean_ogre_cmake_project_1-10.zip and the dist for linux. full tuto

  • Open clean_ogre_cmake_project_1-10.zip and decompress these files in ogreapp folder
    • BaseApplication.cpp
    • BaseApplication.h
    • CMakeLists.txt
    • TutorialApplication.cpp
    • TutorialApplication.h
  • Open dist.tar.bz2 and decompress the folder dist in ogreapp folder

Open CMakeUI and position path as follow:

  • source: ogreapp (containing the CMakeLists.txt)
  • build: ogreapp_build

CMake - -home-003.png

hit Configure and Generate

Compile the example.

$ cd ogreapp_build
$ make
$ make install

Using make install is crucial to copy configurations to the build folder.

And launch!

$ cd dist/bin/
$ ./OgreApp

Ogre-TutorialApplication Render Window 629.png


Installation of netbeans

Go to netbeans.org and download the latest C++ version for your architecture.

Once done, launch it and verify that the CMake tool is accessible. Tools > Options > C/C++ > Build tools.

If the CMake Command is empty, locate the executable on your drive, usually at /usr/bin/cmake.


Apply and close the Options panel.

Importing the example

Before importing, verify that you have called make install in the build folder. The application will crash if the dist folder is only containing the runnable.

Go to File > New project

Netbeans new Project 631.png

Select C/C++ Project with Existing Sources and press Next

Netbeans new Project 632.png

Select the root folder of the project (the one containing the source folder and the build folder), choose Custom configuration mode and press Next.

Netbeans new Project 635.png Netbeans new Project 634.png Netbeans new Project 633.png

  • Check Pre-BuildStep is Required
  • Set the run folder to ogreapp_build/
  • Select Predefined Command
  • Set Script_type to CMake (CMakeList.txt)
  • Set the script to ogreapp/CMakeList.txt

And press Next.

Netbeans new Project 641.png

Set the Working directory to ogreapp_build and press Next until the Finish button shows up. Press it also.

Once the configuration panel closed, netbeans will start to compile the project. It will be quick.

Netbeans project Properties - ogre example 644.png

Before launching,

  • right-click on the project icon in the Projects panel and select Project properties;
  • go to Run;
  • set the Run directory to ogreapp_build/dist/bin/;
  • and Apply.

If the compilation is successful, launch the application by pressing on the green arrow in the top toolbar.

Netbeans select Executable 636.png

A confirmation panel pops-up, the path to the executable should be OgreApp.

Ogre example - NetBeans IDE 8.1 637.png


--Frankiezafe (talk) 19:24, 18 April 2016 (CEST)