Guide for setting up an Ogre application using Visual Studio 2010 (VC10).
- Visual Studio 2010 must be installed. Express and higher.
- The Ogre SDK version 1.7 or greater must be installed.
- Installing the Ogre SDK: Installing the Ogre SDK
- Build Ogre from source with CMake: CMake Quick Start Guide If you are building Ogre from source, you must build the debug and release targets and execute the Install script for both targets as well. This will create a directory structure that is identical to the binary install structure.
Setting Up an Application for Visual Studio 2010
Run setx OGRE_HOME path_to_ogre_sdk in a command console (cmd.exe):
Alternatively, create this handy batch script:
setx OGRE_HOME %CD%
Save it as OGRE_HOME.bat and put it in the root directory of the Ogre SDK.
Run it, and the OGRE_HOME environment variable points to that directory.
Handy when you switch between several Ogre SDKs.
Create a new Win32 project (File -> New -> Project):
Make sure that Windows Application is selected and Empty Project is checked:
Download the Ogre Wiki Tutorial Framework.
Extract Tutorial Framework:
Add Existing Items to Project:
Switching to All Configurations:
General Configuration Properties
Set Character Set to Use Multi-Byte Character Set on the General Configuration Properties page:
Debugging Configuration Properties
Configuration Properties - C/C++ - General - Additional Include Directories
Note: If you are using Ogre >1.9 also add "$(OGRE_HOME)\include\OGRE\Overlay"
Configuration Properties - Linker - General - Additional Library Directories
Configuration Properties - Build Events - Post-Build Event - Command Line
copy "$(OutDir)\$(TargetFileName)" "$(OGRE_HOME)\Bin\$(Configuration)"
Configuration Specific Settings
Switch configuration to "Active(Debug)".
Configuration Properties - Linker - Input - Additional Dependencies - Debug
Add input libraries for debug:
Note: If you are using Ogre >1.9, also add "OgreOverlay_d.lib".
Configuration Properties - Linker - Input - Additional Dependencies - Release
Switch configuration from "Active(Debug)" to "Active(Release)".
Add input libraries for release:
Note: If you are using Ogre >1.9, also add " OgreOverlay.lib".
You've set up an Ogre project succesfully.
All that remains is to build and run it.
Note: If you are running Ogre 1.9 and are getting a runtime error saying: "Cannot locate resource shadows.glsl in resource group Popular or any...", you have to edit "resources_d.cfg" and "resources.cfg" and add "FileSystem=../../media/materials/programs/GLSL" to the files. See this troubleshooting guide if you can not find the files.
If you are getting errors like: "The program can't start because d3dx9_43.dll (or d3dcompiler_43.dll) is missing from your computer...." try to install the DXSDK_Jun10.exe, if you want to use a DirectX renderer. If you only want to use the OpenGL-renderer, edit the "plugins_d.cfg" and "plugins.cfg" files, and edit out the lines
(Put a # in front of them, or delete them!)
Make sure you optimize your build time with Precompiled headers
Render System=Direct3D9 Rendering Subsystem
[Direct3D9 Rendering Subsystem]
Rendering Device=NVIDIA GeForce FX 5200
Video Mode=800 x 600 @ 32-bit colour
[OpenGL Rendering Subsystem]
RTT Preferred Mode=FBO
Video Mode=1024 x 768
Note: If you hear your graphics card squealing when showing the Ogre head, turn Vsync to "yes" in ogre.cfg! Your graphics card will squeal when there are too many frames per second being rendered.