Sign in to follow this  
slurmomatic

[SlimDX] Using WPF and SlimDx (DirectX 10/11)

Recommended Posts

slurmomatic    100
I am using SlimDX with WinForms for a while now, but want to make the switch to WPF now. However, I can't figure out how to get DX10/11 working with WPF. The February release of SlimDX provides a WPF example, which only works with DX 9 though. I found the following solution: Direct3D-10-11-Direct2D-in-WPF but can't get it to work with SlimDX. My main problem is the shared resource handle as I don't know how to retrieve the shared handle from a SlimDX texture. I can't find any information to this topic. In C++ the code looks like this:
HRESULT D3DImageEx::GetSharedHandle(IUnknown *pUnknown, HANDLE * pHandle)
{
    HRESULT hr = S_OK;

    *pHandle = NULL;
    IDXGIResource* pSurface;

    if (FAILED(hr = pUnknown->QueryInterface(__uuidof(IDXGIResource), (void**)&pSurface)))
        return hr;

    hr = pSurface->GetSharedHandle(pHandle);
    pSurface->Release();

    return hr;
}
Basically, what I want to do (because I think that this is the solution), is to share a texture between a Direct3d9DeviceEx (for rendering the WPF D3DImage) and a Direct3d10Device (a texture render target for my scene). Any pointers in the right direction are greatly appreciated.

Share this post


Link to post
Share on other sites
Zoner    232
Quote:
Original post by xoyojank
You should use HwndHost/WindowsFormsHost to host an "render area" in WPF application, D3DImage is only for D3D9


This is not true

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this