Search code examples
helix-3d-toolkit

How can I render my Viewport3DX into a DX11 texture?


I have a 3D engine, and I'd like to be able to embed Helix-based content into it (like draw on a wall). I know it is possible to use RenderTargetBitmap to render any WPF elements, but that would introduce too many levels of indirection (especially considering WPF runs DX9), and no official way to access the image apart from copying it to the CPU memory first.

Ideally, I'd like to supply Viewport3DX with my own target color and depth buffers.


Solution

  • You can get the back buffer from Viewport3DX.RenderHost.RenderBuffer.BackBuffer.Resource as global::SharpDX.Direct3D11.Texture2D

    You can hookup Viewport3DX.RenderHost.Rendered event and copy the buffer data onto your own texture.