How can I use WPF's D3DImage with managed Dire

2020-06-18 10:02发布

问题:

I'd really like to get into some D3D coding, but I don't have the time lately to learn C++ for what will amount to a hobby project.

回答1:

If you're looking for a managed way to do Direct3D programming, I would recommend SlimDX. It's an open source .NET wrapper over DirectX. Since managed DirectX is not being supported any longer by Microsoft, this is a good way to use managed code with D3D. It's updated quite frequently and I've had very good luck using it thus far. There's a thread here that talks about using SlimDX with D3DImage.



回答2:

It's not officially supported as far as I know. Looks like some folks hacked it to make it work.



回答3:

Looks like this might not be an issue for much longer, at least come .NET 4.0. Microsoft showed off a demo of XNA integration with WPF at PDC on Tuesday. If you want to see it in action, you can see the session video at the PDC site:

https://sessions.microsoftpdc.com/public/timeline.aspx

The session is PC46 (WPF Roadmap), XNA demo is around the 38 minute mark. I'm hoping they'll go into more details during the WPF Graphics Futures talk today (Session PC07). Might be a bit down the road, but it's encouraging that they're working on it.



回答4:

Another alternative to managed DirectX and XNA is MOgre, which is a C# wrapper around a great open source C++ graphics engine that uses Direct3D, called Ogre3D. (If it is a hobby project, I think you might get going quicker by using an engine like this rather than straight-up D3D. I don't know much about XNA or SlimDX.)

Here is a CodeProject article by Leslie Godwin that takes the D3DImage class (from the Dr. WPF article mentioned by Ian) and shows how to use it with MOgre.

Edit: I created an open source project, called MogreInWpf, for using D3DImage with Mogre, based on Leslie Godwin's code referenced above, and with an alternative sample app.



标签: wpf directx xna