When I started trying to test my MonoGame project on alternative resolutions, I encountered an odd issue. The game does not render properly to fullscreen on resolutions besides 1920 X 1080.
I wrote up this test code to investigate:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace MonogameResTest
{
public class Game1 : Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Texture2D background;
public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
protected override void Initialize()
{
base.Initialize();
graphics.PreferredBackBufferWidth = graphics.GraphicsDevice.DisplayMode.Width;
graphics.PreferredBackBufferHeight = graphics.GraphicsDevice.DisplayMode.Height;
graphics.IsFullScreen = true;
graphics.ApplyChanges();
}
protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);
background = Content.Load<Texture2D>("OnTheWater12");
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
spriteBatch.Begin();
spriteBatch.Draw(
background,
graphics.GraphicsDevice.Viewport.Bounds,
Color.White);
spriteBatch.End();
base.Draw(gameTime);
}
}
}
When I set my computer’s resolution to 1920 X 1080 (native) this code works fine, the texture renders to cover the whole screen.
However, when I set my resolution to other values, the texture renders in a smaller rectangle centered on the screen, as seen here.
I have the same issue as @iWiggins but my smaller RT is rendered top left.(with HardwareModeSwitch)
If I skip HardwareModeSwitch (ie: false), it does not stretch at all.
I have to toggle fullscreen twice to make the 1280x720 effectively fullscreen.
I keep it this way for now, too much work elsewhere on the engine ^^
I actually gave up on that once, and just had my game launch a separate app and then exit itself, and the other app would wait for the game to close, and then relaunch it with the new settings, and then close itself