I am using Monogame 3.8 and having a weird problem which didn’t happen in early versions.
I create large RenderTarget2D and draw to it. End() is called. I plan to use this for drawing as Texture2D
I can draw it out as a Texture2D and it looks like that above. All good yet.
Now I have a new RenderTarget2D. I take the above Rendertarget2D, draw it to that new RenderTarget2D and add a translationMatrix which positions the viewport centered on the red X and the boundary of the viewport is the red square, it only shows what is in the red square. Draws as expected, all good yet.
Now I will take that first RenderTarget2D. Draw it again, it got culled somehow? And yes I am drawing at the 0,0, so i know it is onscreen. I can see it with output debugging.
Pseudocode example:
GraphicsDevice.SetRenderTarget(OriginalRenderTarget);
GraphicsDevice.Clear(Color.Black);
SBatch.Start();
SBatch.Draw(); // draw images
SBatch.End();
GraphicsDevice.SetRenderTarget(ViewPortRenderTarget)
GraphicsDevice.Clear(Color.Black);
SBatch.Start(translationMatrix: ViewportMatrix);
SBatch.Draw(OriginalRenderTarget);
SBatch.End();
GraphicsDevice.SetRenderTarget(null)
GraphicsDevice.Clear(Color.Black);
SBatch.Start();
SBatch.Draw(OriginalRenderTarget);
SBatch.End();
I can’t figure out why? I’ve tried setting different RasterizeStates. Was a new setting introduced somewhere? Any thoughts?
Thanks,
David