[SOLVED] OpenGL AntiAliasing not working on Linux

I am trying to get OpenGL to render stuff with MSAA. I learned from a tutorial that this can be done with OpenGLPixelFormat, like this:

	// Setup a pixel format object to tell the context what level of
	// multisampling to use.
	OpenGLPixelFormat pixelFormat;
	pixelFormat.multisamplingLevel = 4; // Change this value to your needs.
	m_openGL.setPixelFormat(pixelFormat);

	m_openGL.setRenderer(this);
	m_openGL.setContinuousRepainting(true);

	m_openGL.attachTo(*this);

But it seems to have no effect. Am I doing it wrong or is there another way to achieve AntiAliasing?

I am on Ubuntu, JUCE 6.1.0

I think it’s also necessary to call openGLContext.setMultisamplingEnabled (true); in order to enable multisamplig at the level specified in the OpenGLPixelFormat.

That said, multisampling doesn’t seem to work on Linux at all. I’ll investigate whether we can add that feature.

1 Like

Ok thanks for the heads up! I will test it later on my Windows machine.

I don’t know if this is known to the devs, but there seems to be another issue with OpenGL on Linux when running with NVIDIA Gtx cards, where they output thousands of FPS, which locks the GUI when using v-sync. See this post for details. (Sry this is probably not the right place to report this.)

We just fixed an issue where the screen was being repainted unnecessarily:

There’s a (small) chance that this is related to the performance issue you’re seeing. Please could you try out the latest develop branch and see whether the issue is resolved there?

I built against commit you linked, the problem persists.

Ok the MSAA works fine on windows with the above code!

That would be pretty sweet!

It seems to get antialiasing when using the GL_LINE_STRIP draw call, you just have to specify

glEnable(GL_LINE_SMOOTH);

in your renderOpenGL() call. Awesome!

Thanks for your patience. The following commits should enable anti-aliasing support on Linux and Android:

Note that not all hardware will support anti-aliasing, so there’s a chance it may not work, e.g. on some Android devices.

2 Likes

Sweet! I just gave it a try on my machine and it seems to be working, thanks!