Jump to content
  • Advertisement
Sign in to follow this  
myvraccount

Render to a texture

This topic is 986 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

Using SharpDX/SlimDX in C# (or VB.NET if you prefer), how can I render onto a texture?  I'm pretty sure where I render has to do with RenderTargetView, and if I get the RenderTargetView.Resource, I can convert it to a Texture2D.

 

That's great, but I have an uneasy feeling, because I still notice that my SwapChainDescription.OutputHandle may not be null, and it supposedly must point to some kind of window or other control on which I can draw.  But why would I need that if I'm only rendering onto a texture, not a form?

 

Am I going about this the right way?

Share this post


Link to post
Share on other sites
Advertisement

I believe the swapchain is only used when you commit the backbuffer's contents to your display device using the Present() method. If you are just rendering to a texture, then you just don't present, after drawing you can then retrieve the contents of your texture and do whatever you want with it.

 

I am pretty sure if you are only doing offscreen rendering (for instance some command line conversion tool) then you don't even need a swapchain at all.

Edited by Bacterius

Share this post


Link to post
Share on other sites

Oh, that makes more sense, thanks.

 

Although now when I retrieve the Texture2D, it seems to be valid, but then I tried to do something with it that I normally do (I don't remember the details off hand - I may have tried to set it as a resource or something), and it just threw an exception that said there was an incorrect parameter or something.

 

Under the same circumstances with other textures I haven't had that problem, which leads me to believe that although it gave me back a texture, something may somehow be wrong with it.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!