DirectX 11 as DLL + WPF for UI

Started by
1 comment, last by BlackJoker 11 years, 1 month ago

Hello,

I want to start developing my own game editor and I want to use WPF for UI part.

As far as I use DirectX 11, I have some troubles with connecting DX 11 to WPF.

I know that exists 2 methods:

1) using WinForms control inside WPF

2) using D3DImage.

But D3DImage using only DirectX 9 and I cannot find solution that clearly describes what I need to do to get DX 11 work via D3DImage.

What would you advice in my case? Which variant is better?

And if you use 2nd variant, please, provide me code for interop with DX11 via D3DImage.

Thanks in advance.

Advertisement

There is a third method, which is to use a HwndHost control. I'm currently using this for an application that I'm working on and it appears to work and meet my needs so far. The main drawback is that most Win32 messages directed to the HWND in the HwndHost are not automatically forwarded to WPF, so I have to actually raise mouse events etc. myself.

Regarding WindowsFormsHost, I haven't tried it but I heard about it after implementing a HwndHost-based DX11Host class. It actually looks like it might be a better method than HwndHost. I may get around to trying this at some point, but I don't see why it won't work.

I have heard of people using a shared surface technique, where you create a D3D9 render target, which should be straightforward in WPF, and somehow getting a D3D11 handle to it. Apparently this works only in Windows 7 or later. I haven't tried this myself, but see

http://msdn.microsoft.com/en-gb/library/windows/desktop/ff476531(v=vs.85).aspx

Thanks for the answer. In that case I will try to implement variant with WinForms control inside WPF window.

This topic is closed to new replies.

Advertisement