Enlarged graphics when upgrading MonoGame from 3.5.1 to 3.7

My project has been on MonoGame 3.5.1 for some time, so I decided to upgrade to 3.7. After converting all my image files to XNBs and resolving several runtime errors, everything looks enlarged despite me not changing any of the code. Is this normal when switching to XNBs, or did something change between versions that would cause this?

You didn’t by any chance tick the box ‘resize to power of two’ for every asset? Didn’t you?

I didn’t check that box. I use decently large sprite sheets, so if they were resized I would have noticed the animations being incorrect.

Then, it seems, you should explain ‘everything looks enlarged’ more. I think a Screenshot would help here.

1 Like

I figured out the problem. I have a scale matrix based on the size of the game window; in MonoGame 3.5 if you set the back buffer width and height in Initialize(), it automatically applies changes. In MonoGame 3.7 it doesn’t do this by default, so you have to apply changes afterwards.

That’s interesting.
What’s the code that is doing that?

Have you tried how it behaves under XNA/FNA?

I had this in my Initialize() in 3.5.1:

graphics.PreferredBackBufferWidth = RenderingGlobals.WindowWidth;
graphics.PreferredBackBufferHeight = RenderingGlobals.WindowHeight;

That alone set the screen size. In 3.7, I had to call graphics.ApplyChanges() after it for it to change the screen size. I’ve never used FNA, but in XNA 4.0 it worked like how 3.5.1 worked. In both versions, any screen changes after Initialize() require applying changes.

I noticed something else that might possibly be related. In 3.7, on the first frame, the total time and elapsed game time are both 0. In 3.5.1, I know that at least the elapsed game time was non-zero.

As a reference, the full MonoGame version I’m on is 3.7.0.1129

I’m pretty sure this is incorrect. Even if it were correct, I still wouldn’t recommend it. XNA creates the GraphicsDevice before Initialize is called. If you change settings after creation the GraphicsDevice has to be reset. That’s unnecessary work and it can cause flickering.

Are you running with a fixed time step? This might be inconsistent with XNA behavior, but I’ll have to check.

This sounds like a bug to me. If you want you can open a bug at Issues · MonoGame/MonoGame · GitHub

The new behavior sounds right to me. no?
Should the first frame be like 0.016 or sometime?

Yeah, I’m running with a fixed time step at 60 FPS. I’m not saying the time or the graphics settings differences I encountered are bugs; I was simply stating what I did to fix the issue. They both make sense to me from a design standpoint.