Reputation: 3391
I have a simple OpenGL application which I'm trying to enable antialiasing (4x MSAA) for. I can't seem to figure out how to do this using AndroidGameView
.
So far I've been forcing 4x MSAA through the Developer Settings
menu as a short term solution but I'd like to be able to do this programmatically. Can anyone shed some light on this?
Upvotes: 3
Views: 1272
Reputation: 3391
Turns out that the way to do this programmatically is to set the GraphicsMode
property in the CreateFrameBuffer()
override of your class inheriting from AndroidGameView
:
protected override void CreateFrameBuffer()
{
// Create a graphics context for OpenGL ES 2.0
ContextRenderingApi = GLVersion.ES2;
// Set the graphics mode to use 32bpp colour format, 24bpp depth, 8bpp stencil and 4x MSAA
GraphicsMode = new GraphicsMode(new ColorFormat(32), 24, 8, 4);
// Create the frame buffer itself by calling the base class method
base.CreateFrameBuffer();
// Custom initialization code here
}
Thanks to Cheesebaron for leading me down the path of looking into the GraphicsMode
property of AndroidGameView
.
Upvotes: 3