I just have a question: I need to draw some WPF geometries in a canvas, and each geometry's surface is a complicate Texture2D in Direct3D 11. I'm using SharpDX and just convert the Texture2D into a MemoryStream then Convert to a WPF ImageSource, because I'm using Compute Shader, the Format.Bgra isn't supported with UAV texture, so I can't use a D3DImage. Since there're performance issue, how can I bind a Texture2D to a WPF Geometry directly? Thanks.
Asked
Active
Viewed 1,064 times
2 Answers
0
Short answer is you can't, WPF 3D is still in its infancy and custom shader support is available for 2D effects only. Best advice I can offer at the moment is to render your geometry onto an XNA surface and display it in an AirspacePopup with your WPF controls on top.

Mark Feldman
- 15,731
- 3
- 31
- 58
-
Well, I didn't use WPF 3D, just the PathGeometry in WPF2D, only the surface is a 2d texture computed by a compute shader. But I haven't find an Effect property in Geometry. How can I render a wpf geometry onto an XNA surface? Thanks – WindyBamboo Jan 08 '14 at 07:53
0
For performance reasons, you should perform the whole rendering with SharpDX and not using WPF Geometries, only D3DImage to synchronize the result of rendering with WPF. If you need to convert a texture from one format to another to match WPF formats, you can simply render a full quad with a simple shader copying the texture. If you are doing this with SharpDX Toolkit, it is fairly easy to develop it as it is providing a WPF control.

xoofx
- 3,682
- 1
- 17
- 32
-
Thanks, I'm now using D3DImage. We now need to do zoom on the geometry, for resolution issue, I need to apply transformation matrix to the d3dimage, and I still need to apply a render transformation to the geometry, how can I synchronize them, currently, when zooming their size are always different. Thanks – WindyBamboo Jan 10 '14 at 13:48