Windows8, WinRT, WOA & Metro

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel
x 76

Re: Windows8, WinRT, WOA & Metro

Post by Assaf Raman »

Assaf Raman wrote:Good idea, I will only have time to look at this in Friday, try to sort it out yourself by comparing the projects.
I didn't feel that well this weekend, it will wait a bit longer.
Watch out for my OGRE related tweets here.
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: Windows8, WinRT, WOA & Metro

Post by KungFooMasta »

Actually I got it working, so no need! But I did have to include d3dcompiler_46.dll into my projects. I don't believe this will pass certification, but I'm told the changes required are minimal and can happen right before submission.

For anybody who wants to get jump started using Ogre inside a Windows Store Application, I have uploaded a set of projects for reference and quick ramp up:
http://stormsonggames.com/downloads/OGR ... amples.zip

In this zip, you will find 4 folders:
1) Dependencies
2) MyAdvancedDirect3DAppWithOgre
3) MyWindowsRuntimeComponent
4) SimpleDirect3DAppWithOgre

- The 4th folder contains a project that statically links Ogre and the DirectX11 RenderSystem plugin, and initializes Ogre without needing any dll's except d3dcompiler_46.dll

- The 2nd folder contains a project which references the "MyWindowsRuntimeComponent" project, which initializes Ogre. This is more similar to my situation, where I have the game project referencing my game framework. This project uses dynamic linking, and loads the RenderSystem as a dll plugin.

Unfortunately the download is ~68MB, and I may not have a lot of bandwidth on my website. However it is online and available for the time being. :)
Creator of QuickGUI!
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: Windows8, WinRT, WOA & Metro

Post by KungFooMasta »

I'm at a point in my WinRT project where I've loaded a model, penguin.mesh, and am trying to render it. However RTSS is not being setup correctly:

Code: Select all

09:28:38: Mesh: Loading penguin.mesh.
09:28:39: Skeleton: Loading penguin.skeleton
09:28:39: Texture: penguin.jpg: Loading 1 faces(PF_R8G8B8,512x512x1) with 9 generated mipmaps from Image. Internal format is PF_A8B8G8R8,512x512x1.
09:28:39: OGRE EXCEPTION(3:RenderingAPIException): Attempted to render to a D3D11 device without both vertex and fragment shaders there is no fixed pipeline in d3d11 - use the RTSS or write custom shaders. in D3D11RenderSystem::_render at ..\..\..\RenderSystems\Direct3D11\src\OgreD3D11RenderSystem.cpp (line 2507)
I'm following the wiki link, however the latest version of RTSS doesn't match the documentation. (http://www.ogre3d.org/tikiwiki/tiki-ind ... der+System)

In the "Initializing the System" section, we have this code:

Code: Select all

	mShaderGenerator->addSubRenderStateFactory(new Ogre::RTShader::PerPixelLightingFactory);
	pMainRenderState->addTemplateSubRenderState(
		mShaderGenerator->createSubRenderState(Ogre::RTShader::PerPixelLightingFactory::Type));	
This generates the following error:

Code: Select all

error C2039: 'Type' : is not a member of 'Ogre::RTShader::PerPixelLightingFactory'
I tried looking through the source of the RTShader component, and the Browser WinRT project, but it's not clear to me what I should be doing. Essentially I have done these steps:

1. In my project resources I have created a "ShaderLib" folder. This will contain all my shader definitions, written in hlsl I assume.
2. In my project resources I have created a "ShaderCache" folder. This is meant to store all compiled shaders. I assume RTShader generator will compile the shaders if it cannot find any.
3. I have specified the ShaderGenerator's Cache path, the location where compiled shaders are output. I will need to take these and copy them into my "ShaderCache" prior to app submission, since WinRT apps are not allowed to compile shaders during runtime.
4. Whenever I create a SceneManager, I add it to the ShaderGenerator.

I have never worked with Shaders in the past, I've only used the basic "fixed pipeline" style of rendering. How can I setup the RTShader system to give me this?
Creator of QuickGUI!
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: Windows8, WinRT, WOA & Metro

Post by KungFooMasta »

I realized the Fixed Function Pipeline shaders might not be built into the RTShader source, so I looked through the Sample Media and found a bunch of shaders, which I think I will need:

FFPLib_Common.hlsl
FFPLib_Fog.hlsl
FFPLib_Lighting.hlsl
FFPLib_Texturing.hlsl
FFPLib_Transform.hlsl

I have added them to my game's resources, however I still get the following error:

Code: Select all

11:58:15: OGRE EXCEPTION(3:RenderingAPIException): Attempted to render to a D3D11 device without both vertex and fragment shaders there is no fixed pipeline in d3d11 - use the RTSS or write custom shaders. in D3D11RenderSystem::_render at ..\..\..\RenderSystems\Direct3D11\src\OgreD3D11RenderSystem.cpp (line 2507)
I did notice that the shaders are being compiled and cached by the RTShader system:

4afb3a55-a8b4-e1b1-56b9-c8f5156ba98d_FS.hlsl
8d7b2583-d735-a3ff-3a4c-1f33e1340715_VS.hlsl

Questions:
1. Do I need to include RTShaderSystem.material in my resources?
2. Do I need to set my viewport's material scheme? (I have tried with/without this code)

Code: Select all

mOgreViewport->setMaterialScheme(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
3. Do I need to use the ShaderGenerator against every material, prior to use?

Code: Select all

mShaderGenerator->createShaderBasedTechnique("Penguin", Ogre::MaterialManager::DEFAULT_SCHEME_NAME, Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME);
With that code I get a different kind of error:

Code: Select all

12:06:05: OGRE EXCEPTION(3:RenderingAPIException): Unable to set D3D11 vertex declarationID3D11Device::CreateInputLayout: An Input Layout is being created with 0 elements.  This is valid to do, perhaps as a degenerate case. This warning is for the author to verify whether intent was to have more than 0 elements.

Bound shader name: 8d7b2583-d735-a3ff-3a4c-1f33e1340715_VS in D3D11VertexDeclaration::getILayoutByShader at ..\..\..\RenderSystems\Direct3D11\src\OgreD3D11VertexDeclaration.cpp (line 224)
4. What does the following code do?

Code: Select all

Ogre::RTShader::RenderState* pMainRenderState = 
	mOgreShaderGenerator->createOrRetrieveRenderState(Ogre::RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME).first;
pMainRenderState->reset();
Creator of QuickGUI!
phnix liang
Gnoblar
Posts: 1
Joined: Thu Jan 24, 2013 3:05 am

Re: Windows8, WinRT, WOA & Metro

Post by phnix liang »

hello,when i run your SimpleDirect3DAppWithOgre example code, appear error, the log is "10:01:57: OGRE EXCEPTION(3:RenderingAPIException): Attempted to render to a D3D11 device without both vertex and fragment shaders there is no fixed pipeline in d3d11 - use the RTSS or write custom shaders. in D3D11RenderSystem::_render at ..\..\..\RenderSystems\Direct3D11\src\OgreD3D11RenderSystem.cpp (line 2506)", is anything wrong?
KungFooMasta wrote:Actually I got it working, so no need! But I did have to include d3dcompiler_46.dll into my projects. I don't believe this will pass certification, but I'm told the changes required are minimal and can happen right before submission.

For anybody who wants to get jump started using Ogre inside a Windows Store Application, I have uploaded a set of projects for reference and quick ramp up:
http://stormsonggames.com/downloads/OGR ... amples.zip

In this zip, you will find 4 folders:
1) Dependencies
2) MyAdvancedDirect3DAppWithOgre
3) MyWindowsRuntimeComponent
4) SimpleDirect3DAppWithOgre

- The 4th folder contains a project that statically links Ogre and the DirectX11 RenderSystem plugin, and initializes Ogre without needing any dll's except d3dcompiler_46.dll

- The 2nd folder contains a project which references the "MyWindowsRuntimeComponent" project, which initializes Ogre. This is more similar to my situation, where I have the game project referencing my game framework. This project uses dynamic linking, and loads the RenderSystem as a dll plugin.

Unfortunately the download is ~68MB, and I may not have a lot of bandwidth on my website. However it is online and available for the time being. :)
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: Windows8, WinRT, WOA & Metro

Post by KungFooMasta »

Hi phnix liang,

Unfortunately I was never able to get as far as rendering using RTSS. If I remember correctly there is a Browser sample that is in the repository that is able to use RTSS and run all the Ogre demos inside a "Windows Store Application". I was never able to imitate this functionality in my own project. (If I did figure it out I would have made a tutorial for everybody, but I've since moved on to different things)
Creator of QuickGUI!
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: Windows8, WinRT, WOA & Metro

Post by KungFooMasta »

Hi Ogre Community,

After a long break I have an itch to get Ogre running in a WinRT app. I know people have done it, but I'm having some issues getting Ogre built. My machine has 8.1 on it and only Visual Studio 2013 installed.

Here are the steps I've taken, I'm using the repository links outlined in the first post of this thread: http://www.ogre3d.org/forums/viewtopic.php?f=4&t=69209
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-d ... cies-winrt" and click "Clone"
5. Launch "D:\Sandbox\OgreDependencies\src\OgreDependencies.VS2013.WinRT.sln"
6. Set configuration to Debug mode x86 and build all. Everything built successfully, 4 lib files:
"D:\Sandbox\OgreDependencies\lib\x86\Debug\FreeImaged.lib"
"D:\Sandbox\OgreDependencies\lib\x86\Debug\freetype2311_d.lib"
"D:\Sandbox\OgreDependencies\lib\x86\Debug\zlibd.lib"
"D:\Sandbox\OgreDependencies\lib\x86\Debug\zziplibd.lib"
7. Build dependencies in Release mode, same 4 libs will be produced.

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. Reading "BuildingOgreWinRT.txt"
11. Install CMake: http://www.cmake.org/files/v2.8/cmake-2 ... 32-x86.exe. I added CMAKE to system path.
12. Run CMAKE GUI. Set source code location to "D:/Sandbox/Ogre". Set binary output location to "D:/Sandbox/Ogre"
13. Press Configure. Select "Visual Studio 12" from the list.
14. Set OGRE_DEPENDENCIES_DIR to "D:\Sandbox\OgreDependencies\lib\x86\Release" from Name/Value list. Press Configure.
15. Check/Uncheck desired plugins. Make sure OGRE_BUILD_PLATFORM_WINRT is checked. Press Configure.

I see the following errors:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OIS_INCLUDE_DIR (ADVANCED)
used as include directory in directory D:/Sandbox/Ogre/OgreMain
used as include directory in directory D:/Sandbox/Ogre/RenderSystems/Direct3D11
used as include directory in directory D:/Sandbox/Ogre/PlugIns/OctreeSceneManager
used as include directory in directory D:/Sandbox/Ogre/Components/Paging
used as include directory in directory D:/Sandbox/Ogre/Components/MeshLodGenerator
used as include directory in directory D:/Sandbox/Ogre/Components/Terrain
used as include directory in directory D:/Sandbox/Ogre/Components/RTShaderSystem
used as include directory in directory D:/Sandbox/Ogre/Components/Volume
used as include directory in directory D:/Sandbox/Ogre/Components/Overlay

Configuring incomplete, errors occurred!
See also "D:/Sandbox/Ogre/CMakeFiles/CMakeOutput.log".

16. Click "Add Entry". Set Name to "OIS_INCLUDE_DIR", Type set to FILEPATH, Value: "D:/Sandbox/OgreDependencies/include/OIS". Click OK.
17. Press Configure.
At step 17 I continue to get errors about a missing OIS_INCLUDE_DIR. For some reason when I hit Configure in CMake, the entry is removed from the list.

Can anybody read through my steps above and let me know if I've missed something?
Creator of QuickGUI!
Jake007
Gnoblar
Posts: 9
Joined: Fri Feb 21, 2014 11:15 am

Re: Windows8, WinRT, WOA & Metro

Post by Jake007 »

Hi!

During the last few day, I've also been struggling with building Ogre3D for WinRT platform. Also with very little success.

Which branch are you using? I'm having difficulties with "default" branch, but 1.9 builds nicely.
Running sample project is another story. I stumbled upon a bug (link at the bottom of the post).

Otherwise, the only problem I can see in steps you've taken, is at "Build Ogre", step 14. It works for me, if options is set to root of your dependencies folder. In your case "D:\Sandbox\OgreDependencies".

Regards,
Jake

https://ogre3d.atlassian.net/browse/OGR ... ated%20ASC
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: Windows8, WinRT, WOA & Metro

Post by KungFooMasta »

Thanks Jake, I was able to get it all built! I should have tried what you mentioned but I was reading some errors from CMAKE so wasn't sure. There were some other issues that came up for me, compiling the projects, but I was able to adjust project settings, and it all built. And supposedly its all "targeting 8.1". The next step would be to write an app that uses OgreMain and the dx11 render system to draw something. I think I'll add my steps in the wiki somewhere so others can make use of it. My full instructions to build everything here:
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-d ... cies-winrt" and click "Clone"
5. Launch "D:\Sandbox\OgreDependencies\src\OgreDependencies.VS2013.WinRT.sln"
6. Set configuration to Debug mode x86 and build all. Everything built successfully, 4 lib files:
"D:\Sandbox\OgreDependencies\lib\x86\Debug\FreeImaged.lib"
"D:\Sandbox\OgreDependencies\lib\x86\Debug\freetype2311_d.lib"
"D:\Sandbox\OgreDependencies\lib\x86\Debug\zlibd.lib"
"D:\Sandbox\OgreDependencies\lib\x86\Debug\zziplibd.lib"
7. Build dependencies in Release mode, same 4 libs will be produced.

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. Reading "BuildingOgreWinRT.txt"
11. Install CMake: http://www.cmake.org/files/v2.8/cmake-2 ... 32-x86.exe. I added CMAKE to system path.
12. Run CMAKE GUI. Set source code location to "D:/Sandbox/Ogre". Set binary output location to "D:/Sandbox/Ogre"
13. Press Configure. Select "Visual Studio 12" from the list.
14. Set OGRE_DEPENDENCIES_DIR to "D:\Sandbox\OgreDependencies" from Name/Value list. Press Configure.
15. Press Generate.
16. Open up "D:\Sandbox\Ogre\OGRE.sln" in Visual Studio 2013
17. From the solution explorer, right click and remove the following projects: ALL_BUILD, INSTALL, PACKAGE
18. 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".
19. Right click OgreMain project and select "Retarget to 8.1". Select all other projects and hit OK.
20. Build the solution. 3 projects failed to build: OgreMain, OgreMeshLodGenerator, RenderSystem_Direct3D11
21. Right click RenderSystem_Direct3D11 project in solution explorer, open up properties. Configuration Properties -> C/C++ -> General -> Consume Windows Runtime Extension: Yes (/ZW)
22. In OgreMain project, open OgreErrorDIalogWinRT.cpp, and add "#include <iostream>" after the includes.
23. Right click OgreMeshLodGenerator project in solution explorer, open up properties. Configuration Properties -> C/C++ -> General -> SDL checks: No (/sdl-)
24. Build the solution. Everything should be built!
Creator of QuickGUI!
Jake007
Gnoblar
Posts: 9
Joined: Fri Feb 21, 2014 11:15 am

Re: Windows8, WinRT, WOA & Metro

Post by Jake007 »

I'm glad you managed to get it built!
Did you try to build SampleProjectWinRT?

I'd recommend a few changes in your solution:
- At "Build Dependecies" step 6, I'd skip switching configuration and simply use batch build
"BUILD" (menu) => "Batch Build..." and there choose "Select All" and then "Build".
- "Build Ogre", I'd completely skip step 18. Precompiled headers are turned off in every project by default.

For step 23, It'd be probably better to submit a patch initializing vNormal variables to nullptr in
- "Components\MeshLodGenerator\src\OgreLodBuffer.cpp" line 73 and
- "Components\MeshLodGenerator\src\OgreLodInputProviderMesh.cpp" line 124.

In addition, I needed to add D:\Sandbox\OgreDependencies\include to Additional Include directories for projects OgreMain and OgreOverlay.
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: Windows8, WinRT, WOA & Metro

Post by KungFooMasta »

Where is the SampleProjectWinRT? I was trying to find it yesterday but forgot where I saw it. :(

Thanks for the feedback! I've updated my notepad with the steps, I'll re-post them after I've been able to create an Ogre WinRT app. For now I'm just looking at the Browser app and trying to create a barebones minimal app using Ogre. If you can point me to the RT Sample that'd be helpful.

About submitting the patch, I definitely should, it's been a while and I forget the process.. and I'm lazy to figure it out right now. :D
Creator of QuickGUI!
Jake007
Gnoblar
Posts: 9
Joined: Fri Feb 21, 2014 11:15 am

Re: Windows8, WinRT, WOA & Metro

Post by Jake007 »

It's in the Samples\Browser\WinRT\SampleBrowserWinRT.vcxproj. There are also xaml projects.

If it will be at any help in order to get the sample project build, I needed to change/add the following things:
- zzlib library, right click properties => Configuration Properties => Build Events => Post-Build Event, set "Use in build" to "No". Otherwise there is an annoying error which I don't know how to fix.
- SampleProjectWinRT (retarget to Windows 8.1)
* cmake wrongly set include directory for OIS in my case, you'll probably need change to it.
- Also in my case, the folowing were missing (O:\ is in my case .vhdx file mounted, dedicated only to Ogre):
* O:\Dependecies\include
* O:\src\Samples\AtomicCounters\include
* O:\src\Samples\Hair\include
* O:\src\Samples\PNTrianglesTessellation\include
* O:\src\Components\MeshLodGenerator\include
* O:\src\Samples\Tessellation\include
* O:\src\Samples\TerrainTessellation\include

Assets in SampleProjectsWinRT project: I'd recommend that you compile to see which files are missing. Tessellation files are all spelled incorrectly and needed to be renamed in Visual Studio (change file location not rename) and the other files were all missing if I recall correctly. I simply deleted them in good fate hoping it will work.

The last thing you should note are d3dcompiler_46.dll files (or other files)(also in Assets). If you have WinRT SDK installed on different drive paths will be wrong. Again you need to change it as for files before (when you click on the file, there should be a tab or a toolbox named "Properties" and in there "Relative Path" option).

I hope I covered everything. At the end it didn't work :(, so take my steps with some distance :).I didn't have time yet to start it in debugger to see the problem, but my best would be the same error as I encountered before (link to JIRA couple of posts back)
I'm very very new to Ogre so I'd stay away from submitting patches until I get a little more familiar with everything :).
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: Windows8, WinRT, WOA & Metro

Post by KungFooMasta »

Ah, I was doing the same thing as you. I saw the missing include paths, and started adding them in, ended up with the same as you. Then I started getting linker errors, complaints about OgreMain.lib or something. I had the SampleBrowserWinRT.vcxproj opened by itself, and I saw that all the references to the other projects had incorrect file paths. I tried to re-add Ogre as a reference project but it wanted assemblies. Not sure how the .vcxproj files got on that list. Anyways it seems like it might be a lot of work to get the browser sample running, so I've been looking at starting from scratch.

I'm not sure if I'm using an internal version of VS2013 that might be different than what's available to public. This might give you a hint at where I work, but in any case I'm just saying my steps might not match the average user's, I'm not sure.

Previously there was a DirectX App template that was easier to adapt to getting Ogre setup. Now I'm seeing a different app template, so it will take time to try and understand it, if I ever can. :lol:

Here are the starting steps I've taken, very few:
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.
I'm trying to see how D3D is being setup and used, however it looks like all that is abstracted away from the user. Normally I'd say this is a good thing, but I'm wondering if Ogre won't like this, since the DX11 RenderSystem probably handled initialization of D3D previously.

This is basically the constructor of the app that's auto created for us, and it contains this "deviceResources" object that seems to have D3D information already initialized.

Code: Select all

SampleOgreAppMain::SampleOgreAppMain(const std::shared_ptr<DX::DeviceResources>& deviceResources) :
	m_deviceResources(deviceResources)
{
It looks like D3D is already initialized and the swap chain is already set, etc. as part of the constructor.

Can you tell me if you see the same thing?
Creator of QuickGUI!
Jake007
Gnoblar
Posts: 9
Joined: Fri Feb 21, 2014 11:15 am

Re: Windows8, WinRT, WOA & Metro

Post by Jake007 »

The first part (adding other projects add references) worked for me without any problems.

I think I got an idea :)..
I have exactly the same constructor as you. It's also new for me (I migrated to SSD drive yesterday, so my VS 2013 (Ultimate) is fresh from msdn). I remember everything quite different.

After a quick look at a project and initialization, everything is still there, but it was moved to Common\DeviceResources.cpp .
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: Windows8, WinRT, WOA & Metro

Post by KungFooMasta »

Ah sweet. Ok nevermind, I didn't look hard enough, it is the same as before, just need to look at App.h/.cpp. So it can be adapted just like the Browser Sample app. I think its misleading to have an "App" class that creates a "SampleOgreAppMain" class.. but whatever. I remember last time I did this exercise I was able to get Ogre integrated and compiling, but I couldn't render anything. Hopefully things are different this time around. It will take some time to piece things together. I'd like to simplify the app to just App.h and App.cpp if possible. Maybe over the next couple days I'll share some of my code snippets. Would be great if we can get a working skeleton and document it for people to use as a starting point. :D
Creator of QuickGUI!
Jake007
Gnoblar
Posts: 9
Joined: Fri Feb 21, 2014 11:15 am

Re: Windows8, WinRT, WOA & Metro

Post by Jake007 »

It is a little misleading and confusing at start, but I find this new DirectX App template a little more organized as previous.

I'll also try put something together but my hopes aren't high. My experience with Ogre is close to zero. Hopefully it'll change in the near future.
II'll probably start from this http://goo.gl/5CczJ as a reference project (file taken from here http://www.ogre3d.org/forums/viewtopic. ... 55#p476055). Sample browser still worked back then and is the only WinRT solution I know that works without (any known) problems.

That'd be great :)! In addition, maybe a little optimistic, but I'd like to get everything through certification, but one step a time.
I'll also work on it and post my findings here.
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: Windows8, WinRT, WOA & Metro

Post by KungFooMasta »

Ug, its been so long since I've been coding using WinRT APIs and the C++/cx code.

Here are my current set of steps I've documented, in case you're interested:
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.
At this point I'm doing a lot of experimentation. The good news is that I've actually been able to instantiate the Ogre::Root object and have it log messages to a log file:

Code: Select all

	Windows::Storage::StorageFolder^ rootApplicationDataFolder = Windows::Storage::ApplicationData::Current->LocalFolder;

	auto createFileTask = create_task(rootApplicationDataFolder->CreateFileAsync(ConvertSTDStringToPlatformString("Ogre.log"), Windows::Storage::CreationCollisionOption::GenerateUniqueName));
	createFileTask.then([=](Windows::Storage::StorageFile^ ogreLog)
	{
		mOgreRoot = new Ogre::Root(emptyString, emptyString, ConvertPlatformStringToSTDString(ogreLog->Path));
	});
Next is trying to use the d3d11 render system plugin and initialize Ogre Root. I'll have to remove the included d3d code pretty soon.
Creator of QuickGUI!
Jake007
Gnoblar
Posts: 9
Joined: Fri Feb 21, 2014 11:15 am

Re: Windows8, WinRT, WOA & Metro

Post by Jake007 »

My steps are more or less the same to here. The only difference is, that I started with XAML DirectX app. It looks much cleaner and easier to start with (in my opinion).

Here I hit a little obstacle. I'm familiarizing myself with Ogre and C++/CX at the same time. I'll post if I achieve anything.
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: Windows8, WinRT, WOA & Metro

Post by KungFooMasta »

I'm getting an exception in the OgreD3D11 code:

Code: Select all

    BOOL D3D11VideoModeList::enumerate()
    {
        //      int pD3D = mDriver->getD3D();
        UINT adapter = mDriver->getAdapterNumber();
        HRESULT hr;
        IDXGIOutput *pOutput;
        for( int iOutput = 0; ; ++iOutput )
        {
            //AIZTODO: one output for a single monitor ,to be handled for mulimon       
            hr = mDriver->getDeviceAdapter()->EnumOutputs( iOutput, &pOutput );
            if( DXGI_ERROR_NOT_FOUND == hr )
            {
                return false;
            }
            else if (FAILED(hr))
            {
                return false;   //Something bad happened.
            }
            else //Success!
            {
                DXGI_OUTPUT_DESC OutputDesc;
                pOutput->GetDesc(&OutputDesc);

                UINT NumModes = 0;
                hr = pOutput->GetDisplayModeList(DXGI_FORMAT_R8G8B8A8_UNORM,
                    0,
                    &NumModes,
                    NULL );

---->           DXGI_MODE_DESC *pDesc = new DXGI_MODE_DESC[ NumModes ];
                
                ...

                delete [] pDesc;
NumModes is reported as 0, and thus when trying to allocate an array of size 0, and later delete it, an exception happens:
HEAP CORRUPTION DETECTED: after Normal block (#6026) at 0x00CF7D78.
CRT detected that the application wrote to memory after end of heap buffer.
I'll try updating the ogre d3d11 code to latest in depot but I'm not familiar in this area at all. I'm wondering why GetDisplayModeList is returning 0 modes.

[Update] Apparently when using the Simulator it returns 0 modes, when I ran with the "Local Machine" option 54 modes were reported and there was no crash installing the D3D Render System plugin. Arg, I really liked the simulator too, looks like maybe Microsoft has some issue here.
Creator of QuickGUI!
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: Windows8, WinRT, WOA & Metro

Post by KungFooMasta »

Ok found some interesting information. The simulator works similar to remote desktop, and as a terminal session (connected to the simulator) the number of display modes returned is 0. However the real problem is that the logic in the D3D11VideoModeList::enumerate function does not handle this situation gracefully, resulting in a crash trying to delete memory outside the heap, after creating an array of size 0.

I'm not very familiar with TortoiseHG (or any client for that matter :) ) but I'll see if I can submit a patch to fix this. I'm currently trying to evaluate whether or not its meaningful to query/store a VideoModeList for WinRT apps, since by default they are all in fullscreen exclusive mode and cannot be anything else.
Creator of QuickGUI!
User avatar
Borrillis
Kobold
Posts: 27
Joined: Mon Sep 27, 2004 5:44 pm
x 2
Contact:

Re: Windows8, WinRT, WOA & Metro

Post by Borrillis »

So I have been at this like the two of you, and I have just had a bit f success with the SampleBrowser. I followed pretty much the same set of sets that KungFooMasta had posted earlier. Up till this morning I was stuck on the "must have pixel and vertex shader'. To get past that, all I had to do was add

Code: Select all

#define INCLUDE_RTSHADER_SYSTEM
in the OgreBuildSettings.h file. This enabled the SampleBrowser to create the shaders needed. I tried it with the shader cache enabled and disabled and it worked both ways.
Axiom 3D - .Net 3D Rendering Engine
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: Windows8, WinRT, WOA & Metro

Post by KungFooMasta »

Thanks Borrillis. The sample browser is great for showcasing all the samples in a WinRT app, however it links against all the samples and uses OgreBites and whatever else; what I'm after is a very minimal application that just renders an Ogre head using the Octree SceneManager plugin, for example. This exercise also helps me re-learn Ogre a little, and hopefully I can share my steps with others and enable more people writing WinRT apps using Ogre.
Creator of QuickGUI!
User avatar
Borrillis
Kobold
Posts: 27
Joined: Mon Sep 27, 2004 5:44 pm
x 2
Contact:

Re: Windows8, WinRT, WOA & Metro

Post by Borrillis »

Understood, just confirming you're on the right track is all. I am looking forward to hearing your progress as I would love to see a Visual Studio Template for OGRE in the Visual Studio Gallery (hint, hint).
Axiom 3D - .Net 3D Rendering Engine
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: Windows8, WinRT, WOA & Metro

Post by KungFooMasta »

haha. Unfortunately now is the hard part!! There are 2 problems I'm currently facing:

1. I want to draw an Ogre head. ogrehead.mesh is perfectly suited for this. However I don't know how to
1a) bundle ogrehead.mesh with the application so it gets deployed with it. I'm assuming I just add it into the project in visual studio and make sure it isn't included with compilation
1b) get this recognized by Ogre's MeshManager as a valid resource to be used. I've tried adding a resource location, FileSystem="." and making it include all subdirectories, however ogrehead.mesh is never detected.

2. I believe the RTShaderSystem needs to be used since the fixed shader pipeline is not available for d3d11. I'm not familiar with this at all, so initializing it and figuring out how to best hook it into the initialization process will be very trial and error based.

Any help is appreciated. I'm trying to follow the SampleBrowser example and finding myself jumping around a lot. Here is my app code and my instructions, as it might be helpful:

App.h:

Code: Select all

#pragma once

#include "pch.h"

#include "Ogre.h"
#include "OgreD3D11Plugin.h"
#include "OgreOctreePlugin.h"
#include "OgreRTShaderSystem.h"

#include <string>

namespace SampleOgreApp
{
	// Main entry point for our app. Connects the app with the Windows shell and handles application lifecycle events.
	ref class App sealed : public Windows::ApplicationModel::Core::IFrameworkView
	{
	public:
		App();
		virtual ~App();

		// IFrameworkView Methods.
		virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView);
		virtual void SetWindow(Windows::UI::Core::CoreWindow^ window);
		virtual void Load(Platform::String^ entryPoint);
		virtual void Run();
		virtual void Uninitialize();

	protected:
		// Application lifecycle event handlers.
		void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
		void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args);
		void OnResuming(Platform::Object^ sender, Platform::Object^ args);

		// Window event handlers.
		void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args);
		void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
		void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);

		// DisplayInformation event handlers.
		void OnDpiChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args);
		void OnOrientationChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args);
		void OnDisplayContentsInvalidated(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args);

	private:
		bool m_windowClosed;
		bool m_windowVisible;

		Ogre::Root* mOgreRoot;
		Ogre::RenderWindow* mOgreRenderWindow;

		Ogre::D3D11Plugin* mD3D11Plugin;
		Ogre::OctreePlugin* mOctreePlugin;

		std::string ConvertPlatformStringToSTDString(Platform::String^ s);
		Platform::String^ ConvertSTDStringToPlatformString(const std::string& s);
	};
}

ref class Direct3DApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource
{
public:
	virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView();
};
App.cpp:

Code: Select all

#include "pch.h"
#include "App.h"

#include <ppltasks.h>

using namespace SampleOgreApp;

using namespace concurrency;
using namespace Windows::ApplicationModel;
using namespace Windows::ApplicationModel::Core;
using namespace Windows::ApplicationModel::Activation;
using namespace Windows::UI::Core;
using namespace Windows::UI::Input;
using namespace Windows::System;
using namespace Windows::Foundation;
using namespace Windows::Graphics::Display;

// The main function is only used to initialize our IFrameworkView class.
[Platform::MTAThread]
int main(Platform::Array<Platform::String^>^)
{
	auto direct3DApplicationSource = ref new Direct3DApplicationSource();
	CoreApplication::Run(direct3DApplicationSource);
	return 0;
}

IFrameworkView^ Direct3DApplicationSource::CreateView()
{
	return ref new App();
}

App::App() :
	m_windowClosed(false),
	m_windowVisible(true),
	mOgreRoot(nullptr)
{
}

App::~App()
{
	delete mOgreRoot;
}

std::string App::ConvertPlatformStringToSTDString(Platform::String^ s)
{
	// need to convert to narrow (OEM or ANSI) codepage so that fstream can use it 
	// properly on international systems.
	char npath[MAX_PATH];

	// Runtime is modern, narrow calls are widened inside CRT using CP_ACP codepage.
	UINT codepage = CP_ACP;

	if (0 == WideCharToMultiByte(codepage, 0 /* Use default flags */, s->Data(), -1, npath, sizeof(npath), NULL, NULL))
	{
		throw ref new Platform::FailureException("Unable to convert Platform string to std::string!");
	}

	// success
	return std::string(npath);
}

Platform::String^ App::ConvertSTDStringToPlatformString(const std::string& s)
{
	std::vector<wchar_t> wpath(s.length() + 1, '\0');

	// Runtime is modern, narrow calls are widened inside CRT using CP_ACP codepage.
	UINT codepage = CP_ACP;

	(void)MultiByteToWideChar(codepage, 0, s.data(), s.length(), &wpath[0], wpath.size());

	return ref new Platform::String(&wpath[0]);
}

// The first method called when the IFrameworkView is being created.
void App::Initialize(CoreApplicationView^ applicationView)
{
	// Register event handlers for app lifecycle. This example includes Activated, so that we
	// can make the CoreWindow active and start rendering on the window.
	applicationView->Activated +=
		ref new TypedEventHandler<CoreApplicationView^, IActivatedEventArgs^>(this, &App::OnActivated);

	CoreApplication::Suspending +=
		ref new EventHandler<SuspendingEventArgs^>(this, &App::OnSuspending);

	CoreApplication::Resuming +=
		ref new EventHandler<Platform::Object^>(this, &App::OnResuming);
}

// Called when the CoreWindow object is created (or re-created).
void App::SetWindow(CoreWindow^ window)
{
	window->SizeChanged += 
		ref new TypedEventHandler<CoreWindow^, WindowSizeChangedEventArgs^>(this, &App::OnWindowSizeChanged);

	window->VisibilityChanged +=
		ref new TypedEventHandler<CoreWindow^, VisibilityChangedEventArgs^>(this, &App::OnVisibilityChanged);

	window->Closed += 
		ref new TypedEventHandler<CoreWindow^, CoreWindowEventArgs^>(this, &App::OnWindowClosed);

	DisplayInformation^ currentDisplayInformation = DisplayInformation::GetForCurrentView();

	currentDisplayInformation->DpiChanged +=
		ref new TypedEventHandler<DisplayInformation^, Object^>(this, &App::OnDpiChanged);

	currentDisplayInformation->OrientationChanged +=
		ref new TypedEventHandler<DisplayInformation^, Object^>(this, &App::OnOrientationChanged);

	DisplayInformation::DisplayContentsInvalidated +=
		ref new TypedEventHandler<DisplayInformation^, Object^>(this, &App::OnDisplayContentsInvalidated);

	// Disable all pointer visual feedback for better performance when touching.
	auto pointerVisualizationSettings = PointerVisualizationSettings::GetForCurrentView();
	pointerVisualizationSettings->IsContactFeedbackEnabled = false; 
	pointerVisualizationSettings->IsBarrelButtonFeedbackEnabled = false;

	// OGRE INTIALIZATION - I've decided to do this here because we need a CoreWindow handle in order to create the Ogre::RenderWindow object.

	if (mOgreRoot == nullptr)
	{

		// The Ogre Root constructor requires 3 directory paths: Plugin path, config path, log path
		//	1. We don't want to have any dll's and have all the libs build staticly, so we can tell Ogre not to look for any plugins by supply a blank string.
		//	2. Similarly, we won't be using an Ogre.cfg file, so we pass in a blank string.
		//  3. We do want logs produced by Ogre, in case there are some issues that need investigation.  For this we'll create a file and pass its path to Ogre.

		Ogre::String emptyString = Ogre::BLANKSTRING;

		// Since we are using the CreateFileAsync method, and we need to make sure the file exists before we instantiate Ogre::Root, we have to use the .then functionality 
		// to make the operations go in order
		Windows::Storage::StorageFolder^ rootApplicationDataFolder = Windows::Storage::ApplicationData::Current->LocalFolder;

		auto createFileTask = create_task(rootApplicationDataFolder->CreateFileAsync(ConvertSTDStringToPlatformString("Ogre.log"), Windows::Storage::CreationCollisionOption::GenerateUniqueName));
		createFileTask.then([=](Windows::Storage::StorageFile^ ogreLog)
		{
			mOgreRoot = new Ogre::Root(emptyString, emptyString, ConvertPlatformStringToSTDString(ogreLog->Path));

			// Let's continue initializing Ogre here, right after instantiating Ogre::Root

			mD3D11Plugin = OGRE_NEW Ogre::D3D11Plugin();
			mOgreRoot->installPlugin(mD3D11Plugin);

			mOctreePlugin = OGRE_NEW Ogre::OctreePlugin();
			mOgreRoot->installPlugin(mOctreePlugin);

			// Lets set the Render System for Ogre to use. (The D3D11Plugin we just loaded)
			mOgreRoot->setRenderSystem(mOgreRoot->getAvailableRenderers()[0]);

			// Initialize Ogre! (NOTE: We cannot create a Render Window until we have a handle to the CoreWindow of our WinRT app)
			mOgreRoot->initialise(false, "OGRE Sample Browser");

			// Add resource locations before creation of the Render Window. Upon creation, the resource background queue is created, and the material manager and mesh managers are initialized.
			Ogre::ResourceGroupManager::getSingleton().addResourceLocation("Default Resource Group", "FileSystem", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, true);

			// Create our RenderWindow
			Ogre::NameValuePairList miscParams;
			if (window != nullptr)
			{
				miscParams["externalWindowHandle"] = Ogre::StringConverter::toString((size_t)reinterpret_cast<void*>(window));
				mOgreRenderWindow = mOgreRoot->createRenderWindow("SampleOgreApp RenderWindow", window->Bounds.Width, window->Bounds.Height, false, &miscParams);

				// Now that the RenderWindow has been created, we can initialize our ResourceGroups, and all declared Meshes, Textures, and Materials should be detected.
				Ogre::ResourceGroupManager::getSingletonPtr()->initialiseAllResourceGroups();

				Ogre::MeshManager* mm = Ogre::MeshManager::getSingletonPtr();

				// This must be called after the RenderWindow is created, as the D3D11 RenderSystem creates the D3D11GpuProgramManager at this time.
				Ogre::RTShader::ShaderGenerator::initialize();

				// Create a dummy Scene

				// Re-using code from Ogre tutorial: http://www.ogre3d.org/tikiwiki/tiki-index.php?page=Basic+Tutorial+1&structure=Tutorials
				// and from ExampleApplication.h

				Ogre::SceneManager* sm = mOgreRoot->createSceneManager(Ogre::ST_EXTERIOR_CLOSE, "DummyScene");
				sm->setAmbientLight(Ogre::ColourValue(0.5f, 0.5f, 0.5f));
				
				Ogre::Camera* cam = sm->createCamera("DummyCam");
				// Position it at 500 in Z direction
				cam->setPosition(Ogre::Vector3(0, 0, 500));
				// Look back along -Z
				cam->lookAt(Ogre::Vector3(0, 0, -300));
				cam->setNearClipDistance(5);
				
				Ogre::Viewport* vp = mOgreRenderWindow->addViewport(cam);

				//Ogre::Entity* ogreHead = sm->createEntity("Head", "ogrehead.mesh");
				//Ogre::SceneNode* headNode = sm->getRootSceneNode()->createChildSceneNode("HeadNode");
				//headNode->attachObject(ogreHead);

				Ogre::Light* light = sm->createLight("MainLight");
				light->setPosition(20, 80, 50);
			}
		});
	}
}

// Initializes scene resources, or loads a previously saved app state.
void App::Load(Platform::String^ entryPoint)
{
}

// This method is called after the window becomes active.
void App::Run()
{
	// Let's wait until Ogre has been initialized..
	while (mOgreRoot == nullptr)
		CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);

	while (!m_windowClosed)
	{
		if (m_windowVisible)
		{
			CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
			
			// Perform game-logic update

			// Render
			mOgreRoot->renderOneFrame();
		}
		else
		{
			CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending);
		}
	}
}

// Required for IFrameworkView.
// Terminate events do not cause Uninitialize to be called. It will be called if your IFrameworkView
// class is torn down while the app is in the foreground.
void App::Uninitialize()
{
}

// Application lifecycle event handlers.

void App::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args)
{
	// Run() won't start until the CoreWindow is activated.
	CoreWindow::GetForCurrentThread()->Activate();
}

void App::OnSuspending(Platform::Object^ sender, SuspendingEventArgs^ args)
{
	// Save app state asynchronously after requesting a deferral. Holding a deferral
	// indicates that the application is busy performing suspending operations. Be
	// aware that a deferral may not be held indefinitely. After about five seconds,
	// the app will be forced to exit.
	SuspendingDeferral^ deferral = args->SuspendingOperation->GetDeferral();

	create_task([this, deferral]()
	{
		// Insert your code here.

		deferral->Complete();
	});
}

void App::OnResuming(Platform::Object^ sender, Platform::Object^ args)
{
	// Restore any data or state that was unloaded on suspend. By default, data
	// and state are persisted when resuming from suspend. Note that this event
	// does not occur if the app was previously terminated.

	// Insert your code here.
}

// Window event handlers.

void App::OnWindowSizeChanged(CoreWindow^ sender, WindowSizeChangedEventArgs^ args)
{
}

void App::OnVisibilityChanged(CoreWindow^ sender, VisibilityChangedEventArgs^ args)
{
	m_windowVisible = args->Visible;
}

void App::OnWindowClosed(CoreWindow^ sender, CoreWindowEventArgs^ args)
{
	m_windowClosed = true;
}

// DisplayInformation event handlers.

void App::OnDpiChanged(DisplayInformation^ sender, Object^ args)
{
}

void App::OnOrientationChanged(DisplayInformation^ sender, Object^ args)
{
}

void App::OnDisplayContentsInvalidated(DisplayInformation^ sender, Object^ args)
{
}
Instructions:
Creating our Application

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. 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"
14. Configuration Properties -> Linker -> Input -> Additional Dependencies. Add Plugin_OctreeSceneManagerStatic_d.lib, RenderSystem_Direct3D11Static_d.lib, OgreRTShaderSystemStatic_d.lib, dxguid.lib

Make sure the project build successfully.
Make sure the project can run.

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
If you run the application as-is, you will see just a black screen. (you can set the viewport background color to confirm the viewport is setup correctly!) You can see where I was creating my dummy scene, trying to load the Ogre head, its currently commented out. :P
Creator of QuickGUI!
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Re: Windows8, WinRT, WOA & Metro

Post by Kojack »

KungFooMasta wrote: 1b) get this recognized by Ogre's MeshManager as a valid resource to be used. I've tried adding a resource location, FileSystem="." and making it include all subdirectories, however ogrehead.mesh is never detected.
If you have recursive subdirectories enabled on a resource path, it adds the subdirectory name to the name of the resource.
So instead of ogrehead.mesh you need something like "models/ogrehead.mesh" if the mesh is in a models subdirectory of the "." directory.
Post Reply