Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top