Sign in to follow this  
Daniel Protopopov

Hosting WPF inside D3D Application

Recommended Posts

Hello, I'm wondering if it is possible to somehow host or render WPF based application or code inside D3D application. It would be great if you can point me in the right direction, or better off show the code sample. Since WPF is based on D3D, does anyone has ideas on how to access it from OpenGL? Thanks.

Share this post


Link to post
Share on other sites
NewBreed    263
I can't answer your question with any certainty, but the couple of links may give you a push start in the right direction. As for accessing it in OpenGL I've found a number of links that let you embed OpenGL into a WPF application, but nothing the other way around.

http://blogs.msdn.com/greg_schechter/archive/2006/05/02/588934.aspx
http://www.vistax64.com/avalon/192-rendering-wpf-into-directx-surface-device.html

HTH,
NewBreed.

Share this post


Link to post
Share on other sites
Fiddler    860
Disregarding input focus, you could get away with taking a screenshot of the WPF window and using it as a texture in your D3D or OpenGL application. Not terribly efficient and getting input to work correctly is going to be hard, but in theory this should work.

However, why don't you go the other way round, i.e. embed your D3D or OpenGL context inside a WPF window? This is definitely achievable.

Share this post


Link to post
Share on other sites
Promit    13246
You'd think that, since WPF can render via D3D, it would be doable. It's also exactly the kind of implementation detail that's probably not exposed. But if you do find something, I would be really interested to see it.

Share this post


Link to post
Share on other sites
arbitus    440
Quote:
Original post by Daniel Protopopov
Thanks to all replied to this. What I was looking for is to create an overlay using WPF on top of D3D based application, since D3D on XP machines is not up to the job.


Your best bet is to make a WPF application with a fullscreen background image using D3D and D3DImage from WPF. Then, you can overlay WPF controls.

I must warn you that D3DImage is not very performant on XP. However, this will be the most realistic way of accomplishing your goal. I do this, and it works well. Use any other method and airspace restrictions will kill you, even if you try the overlay method.

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