question

GarethWilliams-7012 avatar image
0 Votes"
GarethWilliams-7012 asked Castorix31 commented

3d rendering: uwp c# and c++

I have a uwp app written in c# - all is well with that.
I want to add a 3d rendering feature to render a trajectory of a projectile.
I understand that direct 3d is written in c++, I am very proficient in c++.
Since my app is c#, however can I incorporate c++ code into it to do direct 3d rendering onto the screen?

I have been looking at the 3d game sample project.
The app starts life as c++.
I am starting the other way around with c#

Is this possible with my existing app?

windows-uwpwindows-api
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Castorix31 avatar image
0 Votes"
Castorix31 answered Castorix31 commented

In UWP, 3D rendering can be done with SwapChainPanel


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you, if I understand from the documentation:
1. I add a new project into my solution of the type "Windows Runtime Component (Universal Windows) C++"
2. I Develop the direct3d code in that component
3. I put a SwapChainPanel in my ui xaml where I want it to be rendered
4. I pass the runtime component a reference to that swap chain panel and the data needed for the rendering of the trajectory

Am I on the right track here?



0 Votes 0 ·
Castorix31 avatar image Castorix31 GarethWilliams-7012 ·

Yes
And you can see the sample XAML SwapChainPanel DirectX interop sample
I recompiled it by creating a new UWP project where I added all the files, + the DirectX part (Windows Runtime Component (C++/WinRT)) which is compiled as DLL/winmd then added as Reference :

133063-swapchainpanel.jpg


1 Vote 1 ·
swapchainpanel.jpg (103.1 KiB)