OGRE  1.10.7
Object-Oriented Graphics Rendering Engine
Setting up an OGRE project
see BuildingOgre.md for instructions how to build OGRE itself

CMake Configuration

Ogre uses CMake as its build system. It is recommended that you use it in your project as well. Then all you need is to add the following three lines to your project

1 # specify which version you need
2 find_package(OGRE 1.10 REQUIRED)
4 # the search paths
5 include_directories(${OGRE_INCLUDE_DIRS})
6 link_directories(${OGRE_LIBRARY_DIRS})
8 # copy essential config files next to our binary where OGRE autodiscovers them
9 file(COPY ${OGRE_CONFIG_DIR}/plugins.cfg ${OGRE_CONFIG_DIR}/resources.cfg

These settings include all available components and third party libraries OGRE depends on (e.g. boost) - nothing more to do.

If you installed OGRE in a non-standard path, you will have to set OGRE_DIR to the location of OGREConfig.cmake so find_package can figure out the rest.

For inspecting the detected OGRE installation, the following CMake variables are available

  • OGRE_STATIC - whether ogre was build as static lib
  • OGRE_${COMPONENT}_FOUND - ${COMPONENT} is available
  • OGRE_PLUGIN_DIR - The directory where the OGRE plugins are located
  • OGRE_MEDIA_DIR - The directory where the OGRE sample media is located
  • OGRE_CONFIG_DIR - The directory where the OGRE config files are located

Application skeleton

The easiest way to get started is the OgreBites Component. It handles Ogre startup/ tear down (including Ogre::Overlay, RTSS), input using SDL2 and even includes a Simple GUI System.

This is useful if all you want is to get a Scene with a FPS counter up and running (rapid prototyping). If available it also uses SDL2 for input - you now just have to implement the callbacks.

To use it, simply derive from OgreBites::ApplicationContext and if you want to get input events from OgreBites::InputListener


in the constructor we register ourself as a InputListener

MyTestApp::MyTestApp() : OgreBites::ApplicationContext("MyTestApp")

to handle input events, we then override the according method

bool MyTestApp::keyPressed(const OgreBites::KeyboardEvent& evt)
if (evt.keysym.sym == SDLK_ESCAPE)
return true;

the interesting part however is the setup method

void MyTestApp::setup(void)
// do not forget to call the base first
// get a pointer to the already created root
Ogre::Root* root = getRoot();
// register our scene with the RTSS
// without light we would just get a black screen
Ogre::Light* light = scnMgr->createLight("MainLight");
light->setPosition(0, 10, 15);
// also need to tell where we are
camNode->setPosition(0, 0, 15);
// create the camera
Ogre::Camera* cam = scnMgr->createCamera("myCam");
cam->setNearClipDistance(5); // specific to this sample
// and tell it to render into the main window
// finally something to render
Ogre::Entity* ent = scnMgr->createEntity("Sinbad.mesh");

finally we start everything as

int main(int argc, char *argv[])
MyTestApp app;
return 0;
you can find the full code in Samples/Bootstrap.

OgreBites itself is also a good starting point if you need more control over the Camera or the Window creation. For instance to render into an existing Qt Window.

See also