The Mixed Reality Forums here are no longer being used or maintained.
There are a few other places we would like to direct you to for support, both from Microsoft and from the community.
The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.
For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.
If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.
And always feel free to hit us up on Twitter @MxdRealityDev.
How to develop a DLL module using Mixed Reality
Hello everyone,
I need help with integrating WMR into our C++ framework. I work for automotive company and I need to create a DLL module to encapsulate WMR functionality so we can read tracking and render into Immersive headesets, later to Hololens as well.
I have already integrated a couple of other VR headsets to our application, but I have no idea, how to make this one work. I have never worked with UWP before and this platform seems quite overcomplicated to me.
One of the problems is easy - our framework uses OGL, WMR strictly DX, thank god there is a WGL interop extension to cover it. I also have experience with DX11, so thats sorted out.
The real problems:
I created an empty DLL UWP project in VS2017, then I tried copying parts of the code from BasicHologram sample, but the objects are not recognized, I can't even seem to find a header file that would include stuff like Windows::Graphics::Holographic::HolographicSpace. There are almost no includes in the project either, where do those types come from?
The other problem I see on the "horizon" is that Windows::Graphics::Holographic::HolographicSpace::CreateForCoreWindow needs a window, I assume its a main window for the application. Is there a way not to pass it to the function or to create it in a different way? Because our app already has it's own window (we use wxWidgets) and I don't see a point of having an extra window when the only thing I want to do is to read the tracking and submit a frame. Or am I missing something?
Is there a way to do this stuff in pure C++ and not CX or WinRT? For example via WRL? https://msdn.microsoft.com/en-us/library/hh973459.aspx ? If yes, how?
Thanks in advance
Regards
Joseph
Answers
If I create a project based on "Holographic DirectX 11 App" template, I cannot even run it (compiles just fine), ends up with this:
BTW my system:
2x Intel Xeon E5-2667 v4
128GB RAM
2x nVidia Quadro P6000
Acer AH101 headset
Windows 10 Enterprise x64 ver. 1709 build 16299.371
Visual Studio 2017
I've made some progress, the DLL UWP template does not turn on /ZW for some reason, so after reading this guide
https://msdn.microsoft.com/en-us/library/mt186162.aspx
I made my module prototype compile at least (I just enabled Consume Windows Runtime Extension). But the problem with the window persists - how to get around it?
Are you asking the solution about the CoreWindow parameter of HolographicSpace.CreateForCoreWindow method?
If so, we have to assign a valid CoreWindow when calling this API method, it creates a HolographicSpace that corresponds with the specified window's CoreApplicationView.
Basically, call CoreWindow.GetForCurrentThread method to get the CoreWindow instance for the currently active thread. For example:
auto window = Windows::UI::Core::CoreWindow::GetForCurrentThread();
Ref Walkthrough: Creating a Windows Runtime component in C++ and calling it from JavaScript or C#
Well, it seems I can't read. Development for Win32 (not UWP) is stated in the docs, I missed it for some reason
https://docs.microsoft.com/en-us/windows/mixed-reality/getting-a-holographicspace
I am testing it now, I created an empty Win32 window app to load the dll, at first I couldn't get past IHolographicSpaceInterop::CreateForWindow when I run the code after ShowWindow was called. I have to hide the window first (ShowWindow(hwnd, SW_HIDE)), call CreateForWindow and then show the window again. Strange...
Now I have error when acquiring IHolographicSpaceStatics2 (should I use ActivateInstance, GetActivationFactory or something different?). I get "REGDB_E_CLASSNOTREG Class not registered" error for both... I do this to register for IsAvailableChanged callback
I've found something that is not documented but caused me a rather bad headache - when calling SetDirect3D11Device on HolographicSpace, the device has to be created with D3D11_CREATE_DEVICE_BGRA_SUPPORT, the call fails otherwise. Why isn't it mentioned in here? https://docs.microsoft.com/en-us/uwp/api/windows.graphics.holographic.holographicspace.setdirect3d11device#Windows_Graphics_Holographic_HolographicSpace_SetDirect3D11Device_Windows_Graphics_DirectX_Direct3D11_IDirect3DDevice_