Skip to main content

History: Creating a Windows Store App using OGRE

Source of version: 2

Copy to clipboard
            Hello, Ogre Community!

This tutorial will enable you to build Ogre and get it running in a Windows Store Application.  Another member of the community has used these instructions to create a more reader friendly version with pictures and other information, you can view that here:

http://michaelcummings.net/mathoms/getting-started-guide-using-ogre-3d-on-windows-8.1

If you want something more direct and fast, please follow the instructions below:

BUILDING OGRE:

1. Install TortoiseHG:

http://mercurial.selenic.com/downloads

Build Dependencies

2. Create a folder D:\Sandbox\OgreDependencies
3. From File Explorer, view this folder location, right click, TortoiseHG -> Clone...
4. Enter in "https://bitbucket.org/eugene_gff/ogre-dependencies-winrt" and click "Clone"
5. Launch "D:\Sandbox\OgreDependencies\src\OgreDependencies.VS2013.WinRT.sln"
6. Select Build -> Batch Build... and click "Select All". Click "Build", everything should build successfully.
7. Libs should be placed under "D:\Sandbox\OgreDependencies\lib", for example "D:\Sandbox\OgreDependencies\lib\x86\Debug\FreeImaged.lib".

Build Ogre

8. Created a folder D:\Sandbox\Ogre. From file exporer, right click, TortoiseHG -> Clone...
9. Enter in "https://bitbucket.org/sinbad/ogre" and click "Clone"
10. Install CMake: http://www.cmake.org/files/v2.8/cmake-2.8.12.2-win32-x86.exe. I added CMAKE to system path.
11. Run CMAKE GUI. Set source code location to "D:/Sandbox/Ogre". Set binary output location to "D:/Sandbox/Ogre"
12. Press Configure. Select "Visual Studio 12" from the list.
13. Set OGRE_DEPENDENCIES_DIR to "D:\Sandbox\OgreDependencies" from Name/Value list. Make sure OGRE_STATIC and OGRE_BUILD_PLATFORM_WINRT are set. (checked) Press Configure. Remove Samples, plugins and/or components as necessary and create a minimal list of projects you want to build. Keep pressing Configure until there are no rows outlined in red.
14. Press Generate.
15. Open up "D:\Sandbox\Ogre\OGRE.sln" in Visual Studio 2013
16. From the solution explorer, right click and remove the following projects: ALL_BUILD, INSTALL, PACKAGE
17. Right click OgreMain project and select "Retarget to 8.1". Select all other projects and hit OK.
18. Build the solution. 3 projects failed to build: OgreMain, OgreMeshLodGenerator, RenderSystem_Direct3D11
19. Right click RenderSystem_Direct3D11 project in solution explorer, open up properties. Configuration Properties -> C/C++ -> General -> Consume Windows Runtime Extension: Yes (/ZW)
20. In OgreMain project, open OgreErrorDIalogWinRT.cpp, and add "#include <iostream>" after the includes.
21. Right click OgreMeshLodGenerator project in solution explorer, open up properties. Configuration Properties -> C/C++ -> General -> SDL checks: No (/sdl-)
22. Batch build everything. Everything should be built! (Check Issues below if needed) The libs should be in "D:\Sandbox\Ogre\lib".

Issues?

1. You might need to add "D:\Sandbox\OgreDependencies\include" to the "Additional Include Directories" for the OgreMain and OgreOverlay projects. These paths can be specified in the project properties.
2. Make sure all projects are not using precompiled headers. Select all projects in the solution explorer, 
Right click, than go to "Properties" select "Configuration Properties", than "All Configurations"
and under "Configuration Properties > C/C++ > Precompiled Headers > Precompiled Header" choose "Not Using Precompiled Headers".

CREATING OUR WINDOWS STORE APP

1. Launch Visual Studio 2013
2. File -> New Project...
3. Templates -> Visual C++ -> Store Apps -> Windows Apps -> DirectX App
4. Set name to "SampleOgreApp", location "D:\Sandbox", and check "Create directory for solution". Click OK.
5. Determine whether you will be building in Debug or Release mode. For now lets use Debug mode, and use Debug versions of the Ogre lib. Select "Debug" from the configuration drop down combobox.
6. In solution explorer, Right click SampleOgreApp project, properties. Make sure Configuration is set to "Debug" and Platform set to "Win32". 
7. Configuration Properties -> C/C++ -> General -> Additional Include Directories. Add "D:\Sandbox\Ogre\include" and "D:\Sandbox\Ogre\Ogre\OgreMain\include"
8. Configuration Properties -> Linker -> General -> Additional Library Directories. Add "D:\Sandbox\Ogre\lib\Debug"
9. Configuration Properties -> Linker -> Input -> Additional Dependencies. Add OgreMainStatic_d.lib, FreeImaged.lib, freetype2311_d.lib, zlibd.lib, zziplibd.lib
10. In App.h add the following include:

#include "Ogre.h"

Make sure the project builds successfully. This will verify your lib paths and include paths
Make sure the project can run. Find the green arrow toolbar button and select "Simulator" from the drop down menu. Press then green Arrow button. At this point we have a rotating cube rendered using D3D.

Initializing Ogre

11. Replace App.h with the following code:

12. Replace App.cpp with the following code:

13. Add ShaderGeneratorTechniqueResolverListener.h to the project:

14. Configuration Properties -> C/C++ -> General -> Additional Include Directories. Add "D:\Sandbox\Ogre\Plugins\OctreeSceneManager\include", "D:\Sandbox\Ogre\RenderSystems\Direct3D11\include" and "D:\Sandbox\Ogre\Components\RTShaderSystem\include"
15. Configuration Properties -> Linker -> Input -> Additional Dependencies. Add Plugin_OctreeSceneManagerStatic_d.lib, RenderSystem_Direct3D11Static_d.lib, OgreRTShaderSystemStatic_d.lib, dxguid.lib
16. Add the following files to D:\Sandbox\SampleOgreApp\SampleOgreApp\Assets: ogrehead.mesh, ogre.material, greenskin.jpg, tusk.jpg, spheremap.png
17. Add the files from step 15 to the project by right clicking on the "Assets" folder (filter) in the Solution Explorer, Add -> Existing Item...
18. Copy the following hlsl files to your project (D:\Sandbox\SampleOgreApp\SampleOgreApp\Assets) and add them to the "Assets" folder in the Solution Explorer: FFPLib_Common.hlsl, FFPLib_Fog.hlsl, FFPLib_Lighting.hlsl, FFPLib_Texturing.hlsl, FFPLib_Transform.hlsl
19. Make sure to explicitly right click and set properties for all hlsl files, setting Content=yes and "Do not participate in build". (By default they are recognized)

Make sure the project builds successfully.
Make sure the project can run. You should see an Ogre head!!

Issues?
1. Check Ogre.log. Everybody's path will use a different app GUID, here is mine: C:\Users\bkinsey\AppData\Local\Packages\856f2e6b-4a1a-4e76-9b56-535eee39bd3a_4bzmt7j5bjbb6\LocalState


        

History

Information Version
Sat 29 of Mar, 2014 06:30 GMT-0000 KungFooMasta 7
Sat 29 of Mar, 2014 06:19 GMT-0000 KungFooMasta 6
Thu 20 of Mar, 2014 20:20 GMT-0000 spacegaier 5
Thu 20 of Mar, 2014 20:16 GMT-0000 spacegaier 4
Thu 20 of Mar, 2014 20:02 GMT-0000 KungFooMasta 3
Thu 20 of Mar, 2014 19:59 GMT-0000 KungFooMasta 2
Thu 20 of Mar, 2014 19:58 GMT-0000 KungFooMasta 1