Pergunta

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.

Foi útil?

Solução

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.

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top