DirectX and WPF
Asked Answered
P

1

3

I am trying to develop an application where the UI part is designed by WPF and the engine is developed using C++. I am trying to render a scene using DirectX in native code by getting the window's handle from WPF using WindowsFormsHost method.

Though i do not get any error, no image renders on the screen.

As far as the handle is concerned, I dont see a problem because when i render the scene using OpenGL using the same handle in native code, it works properly.

As far as the initialization part and rendering part is concerned, I dont see a problem because the same part of code works fine in a separate Win32 project.

What might be the cause of this problem? The version of DirectX being used is DirectX10 and OS used is Vista.

Thanks in advance.

Prowl answered 16/12, 2009 at 5:18 Comment(0)
P
3

I think your problem might be caused by the fact that WPF is also using DirectX to render the window. OpenGL probably gets around the issue just by being different.

If you want to render DirectX in a WPF app, have a look at using D3DImage.

http://www.codeproject.com/KB/WPF/D3DImage.aspx

Personnel answered 16/12, 2009 at 7:31 Comment(3)
Ok. But will the problem occur even if the WindowsFormHost is being used, because I beleive WindowsFormHost hosts a separate window apart from that of the application used by WPF ?Prowl
Hey thanks a lot. It works perfectly using d3dimage. Thanks again.Prowl
You shouldn't need a WindowsFormHost because a D3DImage is a native WPF control.Personnel

© 2022 - 2024 — McMap. All rights reserved.