Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Rendering WPF into DirectX surface/device

 
 
Old 01-31-2006   #1 (permalink)
andylarder


 
 

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]


 
 

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]


 
 

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


 
 

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]


 
 

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


 
 

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
 

Thread Tools


Similar Threads
Thread Forum
directx surface unavailable Vista Games
lost directX device Vista Games
RE: lost directX device Vista Games


Vista Forums 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 Ltd

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