Viewport background color

Hi there,
with GraphicsDevice.Clear() you change the background color of the GraphicsDevice. Is there a way to change the background color of a single Viewport?
Thanks…

GraphicsDevice.Clear fills the whole backbuffer - I have never used multiple Viewports, so maybe someone have more information on that. But “clear” is basically a hardware functionality - not sure if Viewports are.

I would actually either just render a sprite over the whole viewport - or - most of the time you have some sort of background anyway, so clearing isn’t even needed (beside clearing zbuffer and stencil)

I mean the “Microsoft.Xna.Framework.Graphics.Viewport” struct Monogame makes available. I’m developing a 2D game with the screen splitted into 2 parts, one part fixed and one scrollable. I use the Viewports to split the screen, no problems here. I just wonder if there is a way to change the background color of a Viewport without filling it using a spritebatch…

Is this what you mean?

GraphicsDevice.Clear(Color.CornflowerBlue);

that sets the color of your background even if not drawing on a render-target.

GraphicsDevice.Clear() change the background color of all the Viewports I create. I want to change the background color of a single Viewport. Of course, I can use a spritebatch to fill the area. I just wonder if there is another way…

In this game I have some “empty” tiles the don’t cover the background of the Viewport. Actually I’m using a spritebatch to fill the area. Just searching for a simpler solution, but I suppose there isn’t one.
Thanks anyway…

your current solution is most likely the simpliest anyway, as there is only 1 backbuffer, any helper classes would do nothing else then printing a half fullscreen quad (which is basically what you do with spritebatch)

As long as you do it together with your regular SpriteBatch Drawings, you should have already the fastest solution, I guess.

Ok, thank you very much…