Closed TobiasLenz-NPE closed 2 years ago
Hi,
The problem with WPF is it's basically "on life support" (this includes .NET Core/5+) as explained here https://dev.to/noseratio/the-signs-of-wpf-currently-being-on-life-support-1h3a
It's stuck with DirectX9, and it's not easy (read: almost impossible) to write 3D code beyond integration with the D3DImage control. See airspace (headache) issues here: https://dwayneneed.github.io/wpf/2013/02/26/mitigating-airspace-issues-in-wpf-applications.html
So the problem is not really to find the good C#/.NET library to use DirectX code, the problem is you won't go very far if you're stuck with WPF.
Hi,
The problem with WPF is it's basically "on life support" (this includes .NET Core/5+) as explained here https://dev.to/noseratio/the-signs-of-wpf-currently-being-on-life-support-1h3a
It's stuck with DirectX9, and it's not easy (read: almost impossible) to write 3D code beyond integration with the D3DImage control. See airspace (headache) issues here: https://dwayneneed.github.io/wpf/2013/02/26/mitigating-airspace-issues-in-wpf-applications.html
So the problem is not really to find the good C#/.NET library to use DirectX code, the problem is you won't go very far if you're stuck with WPF.
Well then I have to plan for migrating the whole codebase to something else that is not UWP (can't stand it) maybe I go back to WinForms or just use a 3rd party Lib for the UI. I don't require Direct X, OpenGL ect. is fine too, what matters is the performance to me. So it would need to be something with Hardware accel, and the customer got potato pc's so Vulkan isn't a option anyways, beside the total overkill and mountain of work it requires to set up^^.
I began the attempt to port the cube example to WPF. It's really slow going since it is mostly guess work for me at this point but I at least managed to create a dummy HWND to use with the swap chain and finally got the stupid shader to compile via code. My Idea is to strongly reference the DX9 M$ tut and use your Lib. Maybe I can get it up and running soon. I'm determined to make it work somehow because it's now a question of pride for me and am very annoyed 👍 .
UWP is also on end of life https://visualstudiomagazine.com/articles/2021/10/19/uwp-migration.aspx (I personally never liked it either mostly because of packaging and sandbox issues), so I certainly wouldn't go this route.
WinUI 3 (not 2!) is the future of desktop application development on Windows.
IMHO, you'll never fully succeed with WPF and anything other than DX9 because of airspace issues (and flickering, and performance, etc.). I tried that too. Basically the DWM Desktop Window Manager owns the screen, not WPF.
With WinUI 3, you can write desktop Win32 apps and have swapchains compatible with DWM and all other nice Direct X interop capabilities. It's a bit in a early stage for me, but its architecture is what we waited for a long time on Windows.
Otherwise, I must mention this project of my own: https://github.com/aelyo-softworks/Wice that's based on DirectN, WinRT Composition, and nothing else. It's in itself a good sample of using raw DirectX with Win32 in C#.
UWP is also on end of life https://visualstudiomagazine.com/articles/2021/10/19/uwp-migration.aspx (I personally never liked it either mostly because of packaging and sandbox issues), so I certainly wouldn't go this route.
WinUI 3 (not 2!) is the future of desktop application development on Windows.
IMHO, you'll never fully succeed with WPF and anything other than DX9 because of airspace issues (and flickering, and performance, etc.). I tried that too. Basically the DWM Desktop Window Manager owns the screen, not WPF.
With WinUI 3, you can write desktop Win32 apps and have swapchains compatible with DWM and all other nice Direct X interop capabilities. It's a bit in a early stage for me, but its architecture is what we waited for a long time on Windows.
Otherwise, I must mention this project of my own: https://github.com/aelyo-softworks/Wice that's based on DirectN, WinRT Composition, and nothing else. It's in itself a good sample of using raw DirectX with Win32 in C#.
Thanks, I'll take a look at WinUI 3 soon. And will happily use Wince as an Example to learn and maybe get the WPF Box going. I did throw it in a repo, so interested people can use it as a Sample :). Repo: https://github.com/TobiasLenz-NPE/DirectNWpfTest
Hi, if you need a 3D scene graph in c# I think that, at the moment, the best choice is Helix Toolkit. This use SharpDX (so DX9) but it works with WinForms, WPF, UWP and also WINUI3. I have to say it’s not easy to start with this; learning curve is quite high (for me) but I think it could be your best choice
Hello I found your comment in the visual studio dev community and have to say, this project looks very promising.
I would like to use this in my plotter project at work since Oxyplot can't handle thousands of measurement points of flow measurements and starts to chug really badly. Like you move the plot and it takes 1-2 seconds bad. And since all our customer software is written to target Windows 10 + WPF (.Net Core and .Net Framework [nuget packages require it]) would I like to ask if someone got experience in implementing the 3D Renderer in a C# WPF Custom Control and could show/tell me how to do it with this lib, because I just don't know how with C# and WPF (Did render stuff with pure C++ barebones dx and ogl in the past, so I got already experience). would be nice to display the airflow with an actual 3D graph.
To date I tried the Microsoft Recommended method of writing the renderer as C++ DLL, and Importing the DLL Methods in C# to display something (WPF Tut for Direct3D9). Since this is a royal pain in the ass, I went looking for an HW accelerated alternative because the Projects like ShapDX went the way of the dodo.
I hope someone can help me or give me some pointers to educate myself.
All the best, Tobias