Hosting WPF inside D3D Application

Started by
4 comments, last by arbitus 14 years, 10 months ago
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.
"Don't try. Do it now."
Advertisement
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.
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.

[OpenTK: C# OpenGL 4.4, OpenGL ES 3.0 and OpenAL 1.1. Now with Linux/KMS support!]

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.
"Don't try. Do it now."
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.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
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.

This topic is closed to new replies.

Advertisement