   Render2TextureXNA
  Hy!I want to do some image processing with HLSL on a texture. Now I have my shader, input, output textures, the screen quad vb, and all the necessary vertex declarations. Now comes the render to texture part but I simply cannot understand how to do it. I've made it a few times in d3d9, but in XNA it seem to be more complicated with it's ResolveTexture2D and RenderTarget2D stuff. Can anyone post a few word for me or send links or code to make it clearer?THX!   
  You can just ignore ResolveTexture2D, it's only for resolving the backbuffer. All you need to do is:-Create a RenderTarget2D during initialization-When you want to render to it, set it onto the device with GraphicsDevice.SetRenderTarget()-When you're done rendering to it, un-bind it from the GraphicsDevice by setting a different render target-When you want to sample it as a texture, just call RenderTarget2D.GetTexture()   ;  OK! Thank you!There is one more thing:I get the error message:"The render target must not be set on the device when calling GetTexture."When I try to:sprites.Draw(tTargetTexture0.GetTexture(), new Rectangle(0, 128, tTargetTexture0.GetTexture().Width, tTargetTexture0.GetTexture().Height), Color.White);I do not really understand this error message. I did not set tTargetTexture0 as the render target... however I tried that too: it throws the same error.   ;  I think you'll also get this error (confusingly) if you've never rendered to tTargetTexture0 before.  So you have to at least have set it as the render target once (and then reset the render target to null before using tTargetTexture0's texture).   ;  Thanks. It works. I still do not know why do I need to do this setTgt(myTex) setTgt(null) thing, but at least it works.   