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
- Ogre:Android - How to port Ogre3D to the Android platform.
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".
- daehyun_lee_-_ogre3d_tutorials-01.pdf - Lecture 01: Introduction to the ogre3d engine
- daehyun_lee_-_ogre3d_tutorials-02.pdf - Lecture 02: The rendering process
- daehyun_lee_-_ogre3d_tutorials-03.pdf - Lecture 03: Scene composition
- daehyun_lee_-_ogre3d_tutorials-04.pdf - Lecture 04: Frame listeners
- daehyun_lee_-_ogre3d_tutorials-05.pdf - Lecture 05: Scaling and rotation
- daehyun_lee_-_ogre3d_tutorials-06.pdf - Lecture 06: Animation
- daehyun_lee_-_ogre3d_tutorials-07.pdf - Lecture 07: Cameras and viewports
- daehyun_lee_-_ogre3d_tutorials-08.pdf - Lecture 08: Quaternions and rotation
- daehyun_lee_-_ogre3d_tutorials-09.pdf - Lecture 09: Character controller
- daehyun_lee_-_ogre3d_tutorials-10.pdf - Lecture 10: Light sources
- daehyun_lee_-_ogre3d_tutorials-11.pdf - Lecture 11: gui (i)
- daehyun_lee_-_ogre3d_tutorials-12.pdf - Lecture 12: Game framework
- daehyun_lee_-_ogre3d_tutorials-13.pdf - Lecture 13: gui (ii)
- daehyun_lee_-_ogre3d_tutorials-14.pdf - Lecture 14: gui (iii)
- daehyun_lee_-_ogre3d_tutorials-15.pdf - Lecture 15: Rendering terrain, sky, and fog
- daehyun_lee_-_ogre3d_tutorials-16.pdf - Lecture 16: Particle systems
- daehyun_lee_-_ogre3d_tutorials-17.pdf - Lecture 17: Terrain collision handling
- 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.
- Download the Ogre3D source code from http://bitbucket.org/sinbad/ogre/.
- 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)
- Download CMake.
- Download MinGW.
- Download boost.
- Compile boost. See the corresponding page for detailed installation (compilation) steps.
- Navigate to C:\boost
- Open
index.htmland go to "Getting Started" -> "Getting Started on Microsoft Windows" - 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:
- Whenever you're supposed to run "bootstrap.bat", run "bootstrap.bat gcc" instead.
- As you are using MinGW, specify gcc as toolset when actually building boost.
- Building boost takes much time. Get a cup of tea.
- 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. - If you get a "Duplicate name of actual target" error when building boost, use "minimal" build-type instead of "complete".
BOOST_ROOT and Boost_DIR also pointing to C:\boost. - Open the CMake GUI.
- Set "Where is the source code" to C:\Ogre\sources\dependencies.
- 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.
- Click "Configure" to init CMake. Select "MinGW Makefiles".
- 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.
- Change
CMAKE_INSTALL_PREFIXto C:\Ogre\built\dependencies. Click "Generate". - Repeat 3) – 6), this time changing
CMAKE_BUILD_TYPEto "Debug". Also change the "Where to build the binaries" folder to C:\Ogre\building\dep-debug. - 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.
- 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.
- Create a new environment variable named
OGRE_DEPENDENCIES_DIRthat points to C:\Ogre\built\dependencies.
- Open the CMake GUI.
- Set "Where is the source code" to C:\Ogre\sources\v1-8.
- 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.
- Click "Configure" to init CMake. Select "MinGW Makefiles".
- If CMake did not find the dependencies, set the
OGRE_DEPENDENCIES_DIRto C:\Ogre\built\dependencies manually. - 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. - Set the
CMAKE_INSTALL_PREFIXto C:\Ogre\built\ogre-sdk. Click "Configure" again. - If everything worked out, you will get a load of new configurations. Make sure to select
OGRE_STATIC,OGRE_INSTALL_SAMPLESandOGRE_INSTALL_DOCS.- If you want a dynamic build, do not select
OGRE_STATIC - You can of course select other plugins as you desire, but this tutorial does only "guarantee" to work for the stated ones.
- If you want a dynamic build, do not select
- Click "Configure" again, resolving all problems that might appear, until everything goes well. Click "Generate".
- Repeat 3) – 9), this time changing
CMAKE_BUILD_TYPEto "Debug". Also change the "Where to build the binaries" folder to C:\Ogre\building\ogre-debug. - 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 > Settingson 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 (
| Add the following to the Defined Symbols (
|
| Add the following to the Include Paths (
| Add the following to the Defined Symbols (
|
| Miscellaneous | |
| Put the following in the 'other flags text box:
| Put the following in the 'other flags text box:
|
GCC C++ Linker options
| Debug | Release |
| Add the following to the libraries (
| Add the following to the libraries (
|
| Add the following to the library search path (
| Add the following to the library search path (
|
| Miscellaneous. | |
| Add the following to the Other Options (
| Add the following to the Other Options (
|
Notes
- Eclipse will build with the Configuration you leave selected. You can also change this under
Project > Active Build Configuration -
OGRE_HOMEis a pre-defined environment variable setup by the SDK installer.OGRE_HOMEpoints 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
-
Ogre-hello_world.pdf ↩