在UWP中混合DirectX 12和XAML控件 [英] Mix DirectX 12 and XAML controls in UWP

查看:223
本文介绍了在UWP中混合DirectX 12和XAML控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用C ++/CX和DirectX 12创建一个UWP应用(XAML),以便我可以混合使用XAML控件(如Grid,Button ...)和DirectX(如关卡编辑器),但是我我正在努力寻找一种方法来初始化DirectX以在特定控件(例如Grid)中呈现.

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).

基本模板和所有其他教程仅显示如何在应用程序的整个区域内进行操作.创建设备资源时,我们使用SetWindow(CoreWindow :: GetForCurrentThread());设置绘制窗口.

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());

是否有办法从xaml控件使用hwnd创建设备资源,有没有办法为特定控件获取hwnd?

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?

推荐答案

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.

目前尚不清楚为什么要使用DirectX 12编写关卡编辑器.通常,DirectX 11是易于使用的API.除非您已经达到DirectX 11在CPU端的性能极限,否则它的工作量可能比关卡编辑器还值得.

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.

这篇关于在UWP中混合DirectX 12和XAML控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆