my code looks something like this:
graphicsDevice.Clear(Color.Black); spriteBatch.Begin(); spriteBatch.Draw(contentLoader.VerticalGradient, tileSafe, null, Color.DarkGreen, 0, Vector2.Zero, SpriteEffects.None, 0.5f); // snip a lot, including drawing stuff on the sprite batch. // create a new sprite batch (for snipping) var initialViewport = InitialBatch.GraphicsDevice.Viewport; InitialBatch.GraphicsDevice.Viewport = new Viewport(displayRectangle); var newBatch = new SpriteBatch(InitialBatch.GraphicsDevice); newBatch.Begin(); // draw stuff on the new batch newBatch.End(); InitialBatch.GraphicsDevice.Viewport = initialViewport; // more stuff on the original batch spriteBatch.End();
My problem is the third line of code I just added. I want to have a "background" on what I'm drawing (so it's not just black). So I draw it first.
Before I added that third line, everything worked great. But when I added it, everything drawn on the new/inner batch doesn't get displayed. If I draw it all on the normal sprite batch, it gets drawn (but doesn't get snipped properly), if I remove the drawing of the new texture, then the inner spritebatch works fine.
Additional things I've tried
I've tried moving the depth of the "background" texture, and when I do, it either makes the background disappear, or it makes the inner sprite batch stuff disappear. I want both.
Is there any way I can get both? Am I making sense? Is this inner sprite batch thing just crazy? I thought I used a standard example to do snipping, but maybe I got lucky and stumbled upon something crazy that just happens to work?