Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

[SOLVED] MonoGame is always rendering at 800 x 480 in 3D

$
0
0

@Hyblocker wrote:

I'm currently trying to implement window scaling in my MonoGame game, which I'm developing to learn how the engine works, but when I scale the window, the 3D rendering breaks, as seen below:

For some reason, MonoGame won't change the 3D rendering resolution. The UI is scaling fine, but the 3D rendering isn't

I've tried setting a RenderTexture, I've added the following code to OnResize():

public void OnClientSizeChanged(object sender, EventArgs e)
{
	if (Window.ClientBounds.Width > 0 && Window.ClientBounds.Height > 0 && !resizing)
	{
		resizing = true;

		Graphics.PreferredBackBufferWidth = Window.ClientBounds.Width;
		Graphics.PreferredBackBufferHeight = Window.ClientBounds.Height;
		Graphics.ApplyChanges();
		renderTarget = new RenderTarget2D(Device, Window.ClientBounds.Width, Window.ClientBounds.Height, true, Device.DisplayMode.Format, DepthFormat.Depth24);
		Viewport = GraphicsDevice.Viewport;
		GraphicsDevice.SetRenderTarget(renderTarget);
		resizing = false;
	}
}

Note: Graphics is the GraphicsDeviceManager variable.

This has been bugging me for the past couple days. Any help would be greatly appreciated.

Posts: 6

Participants: 4

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles