MonoGame OpenGL Has 800×480 Screen During Initialize

There seems to be a workflow issue at the startup of a MonoGame app in Windows using OpenGL.

The solution seems to be to perform your own initialisation on the viewport.

The issue is that during Initialize() your app seems convinced it has an 800×480 display, no matter what you have asked for in your back-buffer.

This is not the behavior in XNA, so I’m declaring it broken in MonoGame OpenGL

When you set your preferred back-buffer dimensions to something like 720p…

graphics.PreferredBackBufferWidth = 1280;
graphics.PreferredBackBufferHeight = 720;

… the window might be that size but what renders for the first few seconds is an 800×480 rectangle in the corner.


My fix is to manually create the viewport. ApplyChanges() seems to not do anything immediately. My assumption is there is a WM_RESIZE message pending from that that will asynchronously, at some point update the viewport.

At some point after Initialize() when the core Update() pump fires up the App seems to recognise that it has a 720p display.

So the bit in yellow is the real magic and resolves it for me. All I am doing is explicitly creating a new viewport. This code crashes in XNA, hence the #ifdef for MONOGAME.


I still get the White rectangle for a fraction of a second at the start, but any code in Initialize() that asks for the viewport size, gets the right size.

About James McParlane

CTO Massive Interactive. Ex Computer Whiz Kid - Now Grumpy Old Guru.
This entry was posted in C#, MonoGame, TheGame and tagged . Bookmark the permalink.

2 Responses to MonoGame OpenGL Has 800×480 Screen During Initialize

  1. Pingback: MonoGame – Touch resolution issue in iOS | James McParlane's Blog

  2. eric914 says:

    Could you make your code example text, instead of an image? Makes copy/paste easier.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s