Skip to content
Search

Ogre3d

lastmod 2021-05-18created 2014-10-3119 edits

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.

Categories

Features

  • Features | OGRE - Open Source 3D Graphics Engine
  • Renders simple 3D scenes.
  • Easy-to-use OO interface designed to minimize the effort needed for independence from Direct3D or OpenGL.
  • An extensive example framework makes getting your application running quick and simple; common requirements such as render state management, spatial culling, and dealing with transparency are done for you automatically, saving you valuable time.
  • Cleanly organized design and full documentation of all engine classes.
  • A proven, stable engine used in several commercial products.
  • Sophisticated skeletal animation support.
  • Support for memory management and loading from archive files (ZIP and PK3 files supported).
  • Flexible plugin architecture lets the engine be extended without recompilation.
  • Debugging memory manager for identifying memory leaks.
  • BSP map support.
  • Bump map support (or normal maps).

Tutorials

Daehyun Lee's Ogre3D basic tutorial translations

Some documents are password-protected. The password is "leedaehyun".

  1. daehyun_lee_-_ogre3d_tutorials-01.pdf - Lecture 01: Introduction to the ogre3d engine
  2. daehyun_lee_-_ogre3d_tutorials-02.pdf - Lecture 02: The rendering process
  3. daehyun_lee_-_ogre3d_tutorials-03.pdf - Lecture 03: Scene composition
  4. daehyun_lee_-_ogre3d_tutorials-04.pdf - Lecture 04: Frame listeners
  5. daehyun_lee_-_ogre3d_tutorials-05.pdf - Lecture 05: Scaling and rotation
  6. daehyun_lee_-_ogre3d_tutorials-06.pdf - Lecture 06: Animation
  7. daehyun_lee_-_ogre3d_tutorials-07.pdf - Lecture 07: Cameras and viewports
  8. daehyun_lee_-_ogre3d_tutorials-08.pdf - Lecture 08: Quaternions and rotation
  9. daehyun_lee_-_ogre3d_tutorials-09.pdf - Lecture 09: Character controller
  10. daehyun_lee_-_ogre3d_tutorials-10.pdf - Lecture 10: Light sources
  11. daehyun_lee_-_ogre3d_tutorials-11.pdf - Lecture 11: gui (i)
  12. daehyun_lee_-_ogre3d_tutorials-12.pdf - Lecture 12: Game framework
  13. daehyun_lee_-_ogre3d_tutorials-13.pdf - Lecture 13: gui (ii)
  14. daehyun_lee_-_ogre3d_tutorials-14.pdf - Lecture 14: gui (iii)
  15. daehyun_lee_-_ogre3d_tutorials-15.pdf - Lecture 15: Rendering terrain, sky, and fog
  16. daehyun_lee_-_ogre3d_tutorials-16.pdf - Lecture 16: Particle systems
  17. daehyun_lee_-_ogre3d_tutorials-17.pdf - Lecture 17: Terrain collision handling
  18. daehyun_lee_-_ogre3d_tutorials-18.pdf - Lecture 18: ogre shaders

Ogre 3D GUIs

  • BetaGUI
  • buttonGUI
  • CEGUI (Crazy Eddie’s GUI)
  • Hikari
  • libRocket
  • MyGUI
  • Navi
  • QuickGUI
  • Right BrainGUI
  • Tiny GUI
  • TwOgre

How to compile Ogre3D with MinGW

Describes how to compile the Ogre3D source code with MinGW.

Compiling requires the Boost, Cg, FreeImage, freetype, OIS, zlib, and zziplib libraries.

  1. Download the Ogre3D source code from http://bitbucket.org/sinbad/ogre/.
  2. Download the libraries needed to compile Ogre3D from this site. (If you use DirectX, download the DirectX SDK from http://www.microsoft.com/en-us/download/details.aspx?id=6812)
  3. Download CMake.
  4. Download MinGW.
  5. Download boost.
  6. Compile boost. See the corresponding page for detailed installation (compilation) steps.
    1. Navigate to C:\boost
    2. Open index.html and go to "Getting Started" -> "Getting Started on Microsoft Windows"
    3. Follow the steps to build boost from sources. You will most likely want to read section 5.3 "Build Binaries from source". Mind the following:
      1. Whenever you're supposed to run "bootstrap.bat", run "bootstrap.bat gcc" instead.
      2. As you are using MinGW, specify gcc as toolset when actually building boost.
      3. Building boost takes much time. Get a cup of tea.
      4. If you use the following line to build boost...
        b2 --build-dir=C:\boost\build toolset=gcc --build-type=complete stage
        ... you will end up with a stage folder in C:\boost. Move the lib folder inside the stage folder to C:\boost so that you end up having a C:\boost\lib folder.
      5. If you get a "Duplicate name of actual target" error when building boost, use "minimal" build-type instead of "complete".
    4. Add C:\boost to PATH and create new environment variables named BOOST_ROOT and Boost_DIR also pointing to C:\boost.
  7. Building the Ogre dependencies.
    1. Open the CMake GUI.
    2. Set "Where is the source code" to C:\Ogre\sources\dependencies.
    3. Set "Where to build the binaries" to C:\Ogre\building\dep-release. THIS IS NOT the final dependencies folder. It is merely the folder we will use to build the SDK.
    4. Click "Configure" to init CMake. Select "MinGW Makefiles".
    5. Based on your setup, CMake may or may not output some errors. Make sure to resolve them before continuing. CMake is usually pretty verbose about what to do. If you are having trouble, you can always ask in our forums, of course . Click "Configure" again until no more errors appear.
    6. Change CMAKE_INSTALL_PREFIX to C:\Ogre\built\dependencies. Click "Generate".
    7. Repeat 3) – 6), this time changing CMAKE_BUILD_TYPE to "Debug". Also change the "Where to build the binaries" folder to C:\Ogre\building\dep-debug.
    8. Open a command line in C:\Ogre\building\dep-release and type in "mingw32-make install". This will take a minute or two. Do this also for the debug folder.
    9. Navigate to C:\Ogre\built\dependencies. Navigate to lib/Release within that folder and copy the cg.lib to lib/Debug. Somehow, the install make misses this.
    10. Create a new environment variable named OGRE_DEPENDENCIES_DIR that points to C:\Ogre\built\dependencies.
  8. Building the Ogre SDK.
    1. Open the CMake GUI.
    2. Set "Where is the source code" to C:\Ogre\sources\v1-8.
    3. Set "Where to build the binaries" to C:\Ogre\building\ogre-release. THIS IS NOT the final SDK folder. It is merely the folder we will use to build the SDK.
    4. Click "Configure" to init CMake. Select "MinGW Makefiles".
    5. If CMake did not find the dependencies, set the OGRE_DEPENDENCIES_DIR to C:\Ogre\built\dependencies manually.
    6. You can ignore the "Boost_DIR-NOTFOUND" if everything else worked well. If you have a look at the vars in "Advanced" CMake mode, you will see that all boost related vars except that one are correct.
    7. Set the CMAKE_INSTALL_PREFIX to C:\Ogre\built\ogre-sdk. Click "Configure" again.
    8. If everything worked out, you will get a load of new configurations. Make sure to select OGRE_STATIC, OGRE_INSTALL_SAMPLES and OGRE_INSTALL_DOCS.
      1. If you want a dynamic build, do not select OGRE_STATIC
      2. You can of course select other plugins as you desire, but this tutorial does only "guarantee" to work for the stated ones.
    9. Click "Configure" again, resolving all problems that might appear, until everything goes well. Click "Generate".
    10. Repeat 3) – 9), this time changing CMAKE_BUILD_TYPE to "Debug". Also change the "Where to build the binaries" folder to C:\Ogre\building\ogre-debug.
    11. Open a command line in C:\Ogre\building\ogre-release and type in "mingw32-make install". This will take some time, so get another cup of tea. Do this also for the debug folder (and get your third cup of tea).

FrameListeners

In Ogre, we can register a class to receive notification before and after a frame is rendered to the screen. That class is known as a FrameListener. This FrameListener interface declares three functions which can be used to receive frame events:

virtual bool frameStarted(const FrameEvent& evt);
virtual bool frameRenderingQueued(const FrameEvent& evt);
virtual bool frameEnded(const FrameEvent& evt);

frameStarted

Called just before a frame is rendered.

frameRenderingQueued

Called after all render targets have had their rendering commands issued, but before the render windows have been asked to flip their buffers over.

frameEnded

Called just after a frame has been rendered.

So, how does it work?

Let's take a peek at Ogre::Root::renderOneFrame:

bool Root::renderOneFrame(void)
{
    if(!_fireFrameStarted())
        return false;

    if (!_updateAllRenderTargets())
        return false;

    return _fireFrameEnded();
}

Here you can see that Ogre::Root, when rendering a frame, fires a FrameStarted event before updating all render targets. And then fires the FrameEnded event when it's done updating.

To see where Ogre::Root fires the FrameRenderingQueued event, we'll take a look at an excerpt from Ogre::Root::_updateAllRenderTargets:

bool Root::_updateAllRenderTargets(void)
{
    // update all targets but don't swap buffers
    mActiveRenderer->_updateAllRenderTargets(false);
    // give client app opportunity to use queued GPU time
    bool ret = _fireFrameRenderingQueued();
    // block for final swap
    mActiveRenderer->_swapAllRenderTargetBuffers(mActiveRenderer->getWaitForVerticalBlank());
    // more code follows ...
}

Ogre3D + mingw + Eclipse

Describes how to integrate Ogre3D, MinGW, and Eclipse.

Build Configuration

The gcc C++ compiler and C++ linker have an ocean of possible configuration option. We'll need to set ours up quite carefully, and differently for each one of the Build Configurations (Debug and Release).

  • Right-Click your Project in the Left Pane and Click Properties
  • Select C/C++ Build > Settings on the Left.
  • Set the Configuration Pull-Down to Release or Debug and in the Tool Settings tab, enter the options from the table below in the appropiate section of the small left tree:

GCC C++ Compiler options

Debug

Release

Add the following to the Defined Symbols (-D)

  • WIN32
  • _WINDOWS
  • _DEBUG

Add the following to the Defined Symbols (-D)

  • WIN32
  • _WINDOWS
  • NDEBUG

Add the following to the Include Paths (-I)

  • "${OGRE_HOME}\include" (Note: Add this with quotes)

Add the following to the Defined Symbols (-I)

  • "${OGRE_HOME}\include" (Note: Add this with quotes)

Miscellaneous

Put the following in the 'other flags text box:

  • -c -fmessage-length=0 -mthreads -fexceptions -fident

Put the following in the 'other flags text box:

  • -c -fmessage-length=0 -mthreads -fexceptions -fident

GCC C++ Linker options

Debug

Release

Add the following to the libraries (-l)

  • OgreMain_d
  • OIS_d

Add the following to the libraries (-l)

  • OgreMain
  • OIS

Add the following to the library search path (-L)

  • " ${OGRE_HOME} \bin\debug" (Note: Add this with quotes)

Add the following to the library search path (-L)

  • " ${OGRE_HOME} \bin\release" (Note: Add this with quotes)

Miscellaneous.

Add the following to the Other Options (-Xlinker[option])

  • --enable-auto-image-base
  • --add-stdcall-alias

Add the following to the Other Options (-Xlinker[option])

  • --enable-auto-image-base
  • --add-stdcall-alias

Notes

  • Eclipse will build with the Configuration you leave selected. You can also change this under Project > Active Build Configuration
  • OGRE_HOME is a pre-defined environment variable setup by the SDK installer. OGRE_HOME points to the directory where the SDK is installed. You can use ${OGRE_HOME} within your build options when setting up paths to specific directories with the SDK that you will need to access.

Documentation

Ogre3D Basic Tutorial 1.5
Ogre3d-basic_tutorial-1.5.zip

See also

Favorite site

References


  1. Ogre-hello_world.pdf ↩

author Zer0 sitemap