【发布时间】:2019-03-22 08:16:05
【问题描述】:
Microsoft 文档提供了在 XAML 和使用 C++ [1] 的 DirectX 交换链之间实现互操作的代码:
Microsoft::WRL::ComPtr<ISwapChainPanelNative> m_swapChainNative;
// ...
IInspectable* panelInspectable = (IInspectable*) reinterpret_cast<IInspectable*>(swapChainPanel);
panelInspectable->QueryInterface(__uuidof(ISwapChainPanelNative), (void **)&m_swapChainNative);
但是,我无法弄清楚我应该如何使用 C++/WinRT 来实现它。
使用此代码时,我收到以下错误消息:
" [...] 'reinterpret_cast': 无法从 'winrt::Windows::UI::Xaml::Controls::SwapChainPanel' 转换为 'IInspectable *' "
我正在使用 DirectX12,Visual Studio 2017。
【问题讨论】:
-
至于我的其余代码,我从一个用于 C++/WinRT 应用程序的空白模板开始,并完全从 [2] 中获取渲染管道。除了应该链接 XAML 和 DirectX 的代码之外,我没有其他构建问题。 [2]:github.com/Microsoft/Xbox-ATG-Samples/tree/master/UWPSamples/…
标签: xaml c++-winrt directx-12