Jump to content
  • Advertisement
Sign in to follow this  
kimchi325

DX11 [SlimDX][DX11] How to create a preview image?

This topic is 2582 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am in the process of creating an editor application where the user can load and place meshes et cetera. I'd want the user to be able to see a preview of a mesh before they place it, so I'd like to render meshes off screen and use the result as a preview image. What's the best way to approach something like that? Searching around I've seen some methods for capturing the whole screen and saving a bitmap, or accessing the device's front buffer data and so on (at least in D3D9), but these kinda seem like overkill for my case. Ideally, I don't ever need to save out anything actually -- I just want to generate these images in memory. Can anyone push me in the right direction? Thanks. :)

Share this post


Link to post
Share on other sites
Advertisement
You can set up a render target to render to a texture off-screen, then use that texture to render your preview. Look up IDirect3DDevice9::CreateRenderTarget and IDirect3DDevice9::SetRenderTarget (sorry, can't remember the SlimDX equivalent) It's even easier in DX11, just create a texture with the D3D11_BIND_RENDER_TARGET and D3D11_BIND_SHADER_RESOURCE bind flags and set it as your render target. No need to capture (ei. copy) anything. Make sure that, when you use a render target, you also set the viewport correctly.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!