please provide examples of using DirectX and SwapChainPanel in c++/Winrt for desktop app. #3264
-
Hello community, I'm trying to port an example code of DirectX from UWP to Desktop APP in C++, but always failure in the porting from UWP/WRL to desktop/Winrt. I searched online but haven't found any example code that is really written in C++/WinRT for WinUI3 desktop APP. also there is not template for using DirectX with C++/Winrt and Winui3 for desktop app (not UWP) Can anyone please provide some examples of using directX and swapchainpanel with C++/Winrt for desktop apps (not for UWP) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
hi everyone, is there any suggestion for this? I just tried many times but got nothing than debug errors. Is there anyone really using C++/WinRT and DirectX for Desktop Apps (not for UWP)? Just get stuck here for 1 month. I have tried win2D but also with problems, so I turned to directX + SwapChainPanel, but seems almost all the examples are written for UWP/C++/CX. |
Beta Was this translation helpful? Give feedback.
-
thank you, guys. yes it seems migrating from C++/WRL/UWP to C++/WinRT/Desktop App is quite simple. I also thought so before starting. however, I have just interpreted the sample code for UWP to Desktop, but It can't run successfully. always failure for below code interpreting
what I do is sth like below:
and I saw also see errors when translate below code
and see errors when translate below code Do I miss something important when port the sample code from UWP to Desktop APP?? |
Beta Was this translation helpful? Give feedback.
-
thank you all very much here just close this thread. include "winrt/Windows.System.Threading.h" makes the threadpool class works for desktop APP. one more thing may be helpful to others |
Beta Was this translation helpful? Give feedback.
thank you all very much
here just close this thread.
include "winrt/Windows.System.Threading.h" makes the threadpool class works for desktop APP.
the example code doesn't have this header file included in pch.h, but in WinUI3 for desktop we need to manually include this header file.
one more thing may be helpful to others
I found this article from microsoft regarding Asynchrony, and interop between C++/WinRT and C++/CX, it provided a way to make this pointer always alive by Derive LowLatencyInputMain from public winrt::implements<LowLatencyInputMain, winrt::Windows::Foundation::IInspectable>, and then use [this, self=get_strong] in the capture list to make everything working. by this meth…