====== Steps for Building a New Ogre App Totally from Scratch ======
This is a condensed, corrected and **Windows only version** of the information provided on the [[http://www.ogre3d.org/tikiwiki/Building+Ogre|Building Ogre]] and [[http://www.ogre3d.org/tikiwiki/Setting+Up+An+Application+-+Visual+Studio|Setting Up An Application]] wiki pages on the [[http://www.ogre3d.org/tikiwiki/|Ogre Wiki]]. Go there directly for more information and for setting this up on other platforms.
**General Preparation**
- Download and install [[http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express|Microsoft Visual C++ Express 2010]] (if you don't have it)
- Download and install [[http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=10084|Microsoft DirectX SDK (February 2010)]]
**Building Ogre from Source Files**
- Download and decompress the [[https://sourceforge.net/projects/ogre/files/ogre/1.7/ogre_src_v1-7-3.exe/download|OGRE 1.7.3 Source For Windows]] (this should create the folder "ogre_src_v1-7-3")
- Download [[https://sourceforge.net/projects/ogre/files/ogre-dependencies-vc%2B%2B/1.7/OgreDependencies_MSVC_20101231.zip/download|Microsoft Visual C++ Dependencies Package]], unzip it, and place the folder ''Dependencies'' inside ''ogre_src_v1-7-3''
- Build the ''ogre_src_v1-7-3\Dependencies\src\OgreDependencies.VS2010.sln'' solution
- Download and install [[http://www.cmake.org/files/v2.8/cmake-2.8.7-win32-x86.exe|CMake]] (Recommend "Add CMake to the system PATH" option)
- Run "CMake (cmake-gui)"
- Browse to ''ogre_src_v1-7-3'' to enter location of source code
- Create and browse to a separate directory for the built binaries, e.g. ''ogre_built''
- Press "Configure" and pick your target compiler (i.e. Visual C++ Express 2010) (when done, you see new configuration variables in red)
- Press "Configure" again (configuration variables turn gray)
- Press "Generate"
- Go to your ''ogre_built'' directory and build the ''OGRE.sln'' solution
- If this build goes well, you can test the Ogre examples by running ''SampleBrowser_d.exe'' under ''ogre_built\bin\debug'' (if built with the debug configuration)
**Creating Your Ogre Application**
- Create a new Win32 project (Windows Application, Empty Project)
- Download and add the [[http://www.ogre3d.org/tikiwiki/tiki-download_wiki_attachment.php?attId=61&page=Ogre%20Wiki%20Tutorial%20Framework&download=y|Ogre Tutorial Framework Files]] to your project
- Configure your project properties (Debug Configuration) (Replace "C:\Development" with your own development directory):
- General -> Character Set -> ''Use Multi-Byte Character Set''
- Debugging -> Command -> ''.\Debug\$(ProjectName).exe''
- Debugging -> Working Directory -> ''.\Debug''
- C/C++ -> General -> Additional Include Directories -> ''C:\Development\ogre_src_v1-7-3\OgreMain\include;C:\Development\ogre_src_v1-7-3\Dependencies\include;C:\Development\ogre_src_v1-7-3\Dependencies\include\OIS;C:\Development\ogre_src_v1-7-3\Samples\Common\include;C:\Development\ogre_built\include''
- Linker -> General -> Additional Library Directories -> ''C:\Development\ogre_built\lib\Debug; C:\Development\ogre_src_v1-7-3\Dependencies\lib\Debug''
- Linker -> Input -> Additional Dependencies -> ''OgreMain_d.lib;OIS_d.lib;%(AdditionalDependencies)''
- Build your project (Debug Configuration)
- Add ''C:\Development\ogre_built\bin\debug'' to your windows system PATH environment variable (so the Ogre DLLs can be found)
- Copy ''resources_d.cfg'' and ''plugins_d.cfg'' into the folder with your new Ogre application (local Ogre configuration)
- Run your application
- After going through a configuration screen you should see a black render window
- Add the following code to your ''TutorialApplication.ccp'' inside the ''TutorialApplication::createScene(void)'' function, build and run.Ogre::Entity* ogreHead = mSceneMgr->createEntity("Head", "ogrehead.mesh");
Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
headNode->attachObject(ogreHead);
// Set ambient light
mSceneMgr->setAmbientLight(Ogre::ColourValue(0.5, 0.5, 0.5));
// Create a light
Ogre::Light* l = mSceneMgr->createLight("MainLight");
l->setPosition(20,80,50);
- You should now see a green Ogre head!