Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

Rendering WPF into DirectX surface/device

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 01-31-2006   #1 (permalink)
andylarder
Guest


 

Rendering WPF into DirectX surface/device

As I understand it, Direct3D and WPF cannot share the same screen space -
however, is there any way of getting WPF to render to a surface that can be
overlayed on top of the main Direct3D image, or better still render to the
current device buffer?

Something like:

void render(Direct3D.Device device)
{
// Call my code to render scene
renderScene(device);

// Call WPF to render window on top of the scene
wpf.renderWindow(device);
}


My System SpecsSystem Spec
Old 01-31-2006   #2 (permalink)
Jason [Mobiform]
Guest


 

Re: Rendering WPF into DirectX surface/device

I second that request

J

"andylarder" <andylarder@discussions.microsoft.com> wrote in message
news:F3706CBB-9CA9-4373-9ED1-9DF0A725F375@microsoft.com...
> As I understand it, Direct3D and WPF cannot share the same screen space -
> however, is there any way of getting WPF to render to a surface that can
> be
> overlayed on top of the main Direct3D image, or better still render to the
> current device buffer?
>
> Something like:
>
> void render(Direct3D.Device device)
> {
> // Call my code to render scene
> renderScene(device);
>
> // Call WPF to render window on top of the scene
> wpf.renderWindow(device);
> }
>



My System SpecsSystem Spec
Old 01-31-2006   #3 (permalink)
Nick Kramer [MSFT]
Guest


 

Re: Rendering WPF into DirectX surface/device

Unfortunately it's not something we'll be able to support in version 1. I
thought there was some discussion on my blog about this, but I'm unable to
find it right now.

--
-Nick Kramer [MSFT]
http://blogs.msdn.com/nickkramer

---
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


"andylarder" <andylarder@discussions.microsoft.com> wrote in message
news:F3706CBB-9CA9-4373-9ED1-9DF0A725F375@microsoft.com...
> As I understand it, Direct3D and WPF cannot share the same screen space -
> however, is there any way of getting WPF to render to a surface that can
> be
> overlayed on top of the main Direct3D image, or better still render to the
> current device buffer?
>
> Something like:
>
> void render(Direct3D.Device device)
> {
> // Call my code to render scene
> renderScene(device);
>
> // Call WPF to render window on top of the scene
> wpf.renderWindow(device);
> }
>



My System SpecsSystem Spec
Old 01-31-2006   #4 (permalink)
andylarder
Guest


 

Re: Rendering WPF into DirectX surface/device

From your blog:

"The final reason it's important plan is that you can get feedback to
Microsoft. I'd like to think WPF is perfect, but it's not -- and we need
your feedback to improve it. The nightmare scenario for everyone is your
company doesn't look at WPF until the second version, and because we didn't
get your feedback, WPF 2.0 is missing that one critical feature you need.
Let us know what you need, so we can make WPF the product you want!"

This is a critical feature for some of us.

Andy.

"Nick Kramer [MSFT]" wrote:

> Unfortunately it's not something we'll be able to support in version 1. I
> thought there was some discussion on my blog about this, but I'm unable to
> find it right now.
>
> --
> -Nick Kramer [MSFT]
> http://blogs.msdn.com/nickkramer
>
> ---
> This posting is provided "AS IS" with no warranties, and confers no rights.
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
>
>
> "andylarder" <andylarder@discussions.microsoft.com> wrote in message
> news:F3706CBB-9CA9-4373-9ED1-9DF0A725F375@microsoft.com...
> > As I understand it, Direct3D and WPF cannot share the same screen space -
> > however, is there any way of getting WPF to render to a surface that can
> > be
> > overlayed on top of the main Direct3D image, or better still render to the
> > current device buffer?
> >
> > Something like:
> >
> > void render(Direct3D.Device device)
> > {
> > // Call my code to render scene
> > renderScene(device);
> >
> > // Call WPF to render window on top of the scene
> > wpf.renderWindow(device);
> > }
> >

>
>
>

My System SpecsSystem Spec
Old 01-31-2006   #5 (permalink)
Radu Margarint [MSFT]
Guest


 

RE: Rendering WPF into DirectX surface/device

While not the cleanest solution, there might a work around. You could use a
RenderTargetBitmap to render the WPF Visual contents into an offscreen
surface, then transfer the contents of that surface into your own DirectX
surface.

void render(Direct3D.Device device)
{
// Call my code to render scene
renderScene(device);

// Call WPF to render window on top of the scene
wpfRenderTargetBitmap.Render(myWpfVisualTree);
wpfRenderTargetBitmap.CopyPixels(myDirectxLockedPointer);

etc.
}

There would issues with transparency however. Not sure how important that
may be for you.

"andylarder" wrote:

> As I understand it, Direct3D and WPF cannot share the same screen space -
> however, is there any way of getting WPF to render to a surface that can be
> overlayed on top of the main Direct3D image, or better still render to the
> current device buffer?
>
> Something like:
>
> void render(Direct3D.Device device)
> {
> // Call my code to render scene
> renderScene(device);
>
> // Call WPF to render window on top of the scene
> wpf.renderWindow(device);
> }
>

My System SpecsSystem Spec
Old 01-31-2006   #6 (permalink)
Michael Latta
Guest


 

Re: Rendering WPF into DirectX surface/device

Unfortunately this would also do all the WPF rendering in software not
hardware, and as you indicated does not support transparency (though that
can probably be dealt with using a pixel shader to render the bitmap).

Michael


"Radu Margarint [MSFT]" <Radu Margarint [MSFT]@discussions.microsoft.com>
wrote in message news:180265DF-6F37-4682-9494-18A73744E159@microsoft.com...
> While not the cleanest solution, there might a work around. You could use
> a
> RenderTargetBitmap to render the WPF Visual contents into an offscreen
> surface, then transfer the contents of that surface into your own DirectX
> surface.
>
> void render(Direct3D.Device device)
> {
> // Call my code to render scene
> renderScene(device);
>
> // Call WPF to render window on top of the scene
> wpfRenderTargetBitmap.Render(myWpfVisualTree);
> wpfRenderTargetBitmap.CopyPixels(myDirectxLockedPointer);
>
> etc.
> }
>
> There would issues with transparency however. Not sure how important that
> may be for you.
>
> "andylarder" wrote:
>
>> As I understand it, Direct3D and WPF cannot share the same screen space -
>> however, is there any way of getting WPF to render to a surface that can
>> be
>> overlayed on top of the main Direct3D image, or better still render to
>> the
>> current device buffer?
>>
>> Something like:
>>
>> void render(Direct3D.Device device)
>> {
>> // Call my code to render scene
>> renderScene(device);
>>
>> // Call WPF to render window on top of the scene
>> wpf.renderWindow(device);
>> }
>>



My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
directx surface unavailable Sergio Vista Games 1 06-20-2008 09:46 AM
lost directX device BonnieT Vista Games 9 03-30-2007 11:44 AM
RE: lost directX device BonnieT Vista Games 0 03-27-2007 07:12 PM
drawing surface, 2D visual surface as plane in the 3D space =?Utf-8?B?UnVlZGlnZXI=?= Avalon 2 07-11-2006 08:38 AM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51