Mix DirectX 12 and XAML controls in UWP

2019-09-10 18:47发布

I would like to create a UWP app (XAML) with C++/CX and DirectX 12 so that I can mix both XAML controls (things like Grid, buttons...) and DirectX, something like a Level Editor, but I'm struggling to find a way how to initialize DirectX to render inside a specific control (like a Grid).

The basic template and all the other tutorials only show how to do it within the full area of the application. When creating a device resource we set the window where to draw with SetWindow(CoreWindow::GetForCurrentThread());

Is there a way how to create a device resource with hwnd from a xaml control and is there a way how to get hwnd for a specific control?

2条回答
Evening l夕情丶
2楼-- · 2019-09-10 19:06
来,给爷笑一个
3楼-- · 2019-09-10 19:20

The information in the article DirectX - Using XAML with DirectX and C++ in Windows Store Apps all applies to mixing Direct3D 11 or Direct3D 12 with XAML.

It's not clear why you'd want to write your level editor with DirectX 12. In general DirectX 11 is a much easier-to-use API. Unless you are already hitting the CPU-side performance limits of DirectX 11, it's probably more work than it's worth for a level editor.

查看更多
登录 后发表回答