Is MSAA supported in MonoGame 3.6 with OpenGL?

Hi everyone,

I’m new to MonoGame and I’ve just spent most of the day trying to get MSAA to work. I’m using MonoGame 3.6 on Windows 7 x64 on a laptop with Optimus (one Intel, one NVidia GPU).

Results so far:
In all experiments I’m setting GraphicsProfile = GraphicsProfile.HiDef;

Using DirectX:
Setting PreferMultiSampling = true crashes (NoSuitableGraphicsDeviceException), unless I manually set MultiSampleCount to <=8, then MSAA works fine. By default MonoGame seems to choose 32, which doesn’t seem to work. Curiously, forcing the NVidia GPU in the driver and overriding the multisampling settings does NOT work with DirectX.

Using OpenGL:
Setting PreferMultiSampling = true does nothing at all, regardless of MultiSampleCount. Interestingly, I CAN use the NVidia driver to override the settings and use up to 32x MSAA.
The source code for GraphicsDevice.OpenGL.cs looks a little weird, large chunks (including parts related to the MultiSampleCount) are commented out.

On which platforms and APIs does MonoGame currently support MSAA? I couldn’t really find any up to date statement, so any hint would be highly appreciated.


This was a bug that unfortunately made it into the release. It’s fixed in development builds.

In develop builds DirectX backend MSAA should work fine. For OpenGL, you can only set MSAA in your game constructor. There’s some complications because of how OpenGL works that make it hard to implement properly. I don’t really know about mobile support.

Thank you for that info! I read about the DirectX bug, but wasn’t sure which version it affected.

How exactly do I setup MSAA in the Game constructor? Currently my code looks like this

public Game1()
    Content.RootDirectory = "Content";

    graphics = new GraphicsDeviceManager(this);
    graphics.GraphicsProfile = GraphicsProfile.HiDef;
    graphics.PreferMultiSampling = true;
    graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs(graphics_PreparingDeviceSettings);

void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
    e.GraphicsDeviceInformation.PresentationParameters.MultiSampleCount = 8;

What am I missing, because like this it doesn’t work in OpenGL.

Thank you very much!

I’m curious about this too. I’m using deferred rendering with OpenGL and I tried all the different options I could find about setting it directly in the constructor, in the PreparingDeviceSettings handler, and on the render target directly, but nothing seems to work. The only difference I’ve noticed is that the screen goes black if I set it on the render target directly, but I haven’t put too much time into investigating why yet.

EDIT: Maybe it’s related to this PR:
I’ll pull that in then try again.

EDIT 2: Nope, still no difference.