I have a problem with using render targets that I am hoping someone can explain to me. I am trying to use a render target to render some sprites, and then draw said render target onto the normal back buffer 50% opaque (null). It works great, except if I use the target more than once in a draw call, in which case only the last group of sprites will appear on the screen.
Here is some psuedo code.
// Normal Sprite Drawing.
DrawSomeSprites();
SetRenderTarget(CompositeTarget);
// These go on the render target.
DrawSomeMoreSprites();
SetRenderTarget(null);
// And now I draw onto the back buffer.
DrawSprite(CompositeTarget);
// So now I want to draw another bunch of sprites via my render target using the same approach.
SetRenderTarget(CompositeTarget);
// These are the only sprites that I can see on the screen.
DrawSomeMoreSprites();
SetRenderTarget(null);
DrawSprite(CompositeTarget);
I hope that makes sense. It seems to me that every time I change the render target, the previous render target (null) is cleared for some reason. I am ending all of my sprite batches before swapping the targets, and I am not getting any errors, so I don't know what to do here. Obviously the goal is to be able to see all of my sprite groups on the screen at the same time. What am I missing here ??