WPF UI in rendered in Direct3D

402 views
Skip to first unread message

Jeremiah Morrill

unread,
Dec 6, 2009, 8:32:19 PM12/6/09
to wpf-di...@googlegroups.com
Yesterday I posted some code to my blog about how to get access to WPF's internal Direct3D stuff.  It's all stuff you would never want to use in a production application, but it's fun for experimentation and possibly a demo to show scenarios I'd personally like to see supported in WPF.

I whipped up a quick D3D scene using one of the D3D tutorial's from the SDK.  It grabs the backbuffer from WPF's Direct3D SwapChain and renders it in a 100% Direct3D window as a texture on 3D.  Here's the video.  You can see me typing in the textbox and clicking the toggle button.  Unfortunately the tutorial example I used is totally ugly, but I'm sick as a dog and don't care atm ;). Gives you a rough idea of though.

-Jer

Pavan Podila

unread,
Dec 6, 2009, 8:35:05 PM12/6/09
to wpf-di...@googlegroups.com
That's some cool hackery !!
--
Pavan Podila, MVP - Client App Dev
Author of WPF Control Development Unleashed
--| http://blog.pixelingene.com |--

Jeremiah Morrill

unread,
Dec 6, 2009, 8:44:47 PM12/6/09
to wpf-di...@googlegroups.com
Thanks Pavan!

I was also thinking of rendering a D3D scene over the WPF content.  Rendering stuff over the backbuffer will make your D3D content always on top, but it differs from "airspace restrictions" because you can render alpha content over it.

Anyways, I'm gonna see later on if I can hack the DWM using similar means.  There'd be a lot of fun stuff to break in there!

-Jer

Pavan Podila

unread,
Dec 6, 2009, 8:47:27 PM12/6/09
to wpf-di...@googlegroups.com
Sweet .. if only we could make those buffers interaction-capable :), we can get some serious perf for some high volume visualizations !

Jeremiah Morrill

unread,
Dec 6, 2009, 8:58:25 PM12/6/09
to wpf-di...@googlegroups.com
Not sure I totally follow.  D3D is only an immediate-mode rendering API, so interaction has always been up to the developer. For example, take user input -> modify camera -> render view.  The same applies to D3DImage, only input comes from WPF events vs windows messages.  Here's a cool video of an interactive D3DImage I found on youtube.  So yeah we can make these interactive :)!

Pavan Podila

unread,
Dec 6, 2009, 9:06:23 PM12/6/09
to wpf-di...@googlegroups.com
That freaking awesome ... We *must* have an easier bridge to XNA in WPF 5 ;) That will enable some great scenarios ...

Jeremiah Morrill

unread,
Dec 6, 2009, 9:16:15 PM12/6/09
to wpf-di...@googlegroups.com
+1!!  Couldn't agree more!

By stuff I've read in the forums, last years PDC videos and a few other places, I know Microsoft has been "toying" with the idea of XNA support.  But nothing as of yet (unless you want to use reflection and get 40% CPU usage). :(

I'm really championing XNA/WPF because what they have is a spectacular framework and it's very .NET friendly.  D3D still has a stigma of being complicated, even with the managed wrappers.  Also, Dx9,10,11,D2D all interop with WPF just fine.  Why's XNA gotta be the bastard child of this scenario?

-Jer

Pavan Podila

unread,
Dec 6, 2009, 9:17:44 PM12/6/09
to wpf-di...@googlegroups.com
Awesome ... If there is a place where I can vote for this, you have my 10,000 votes !

Jeremiah Morrill

unread,
Dec 6, 2009, 9:18:44 PM12/6/09
to wpf-di...@googlegroups.com
I'll see if I can find some addresses and we'll picket outside their house!

Sacha Barber

unread,
Dec 7, 2009, 3:34:49 AM12/7/09
to wpf-di...@googlegroups.com
You really are very strange Jer, keep it up
--
Sacha Barber
sacha....@gmail.com

Richard

unread,
Dec 7, 2009, 3:53:34 AM12/7/09
to wpf-di...@googlegroups.com, wpf-di...@googlegroups.com
You could do a tweet poll and get the community to vote 

Sent from my iPhone
Reply all
Reply to author
Forward
0 new messages