So I’m trying to use multisampling to hopefully help some of the jaggedness my application currently has. Unfortunately, glEnable(GL_ARB_multisample) appears to make no difference on my final image. Is this the correct way to use it?

Using glxinfo it appears my system supports GL_ARB_multisample, so I’m not sure what’s wrong here.

You need to create a “multisampled” rendering target. Choose pixel format that supports multi-sampling (with appropriate MS factor), or a FBO.

Also note that glEnable(GL_MULTISAMPLE) will change nothing, as it’s enabled by default.

glEnable(GL_ARB_multisample); // is something invalid

Right. Just to clarify the above, you need both of the above to do proper multisample rasterization and downsample filtering:

[ol][li]Create a multisampled render target[*]glEnable( GL_MULTISAMPLE ) (or just leave it enabled)[/ol][/li]
And I have no idea what you’re talking about with glEnable( GL_ARB_multisample ). GL_ARB_multisample is the name of an OpenGL extension and not a GL state enable. In glext.h, it is a preprocessor symbol used to prevent multiple includes and is defined to 1 like all other similar preprocessor lock symbols. Your glEnable would translate to glEnable(1) which probably isn’t even valid. It’s not what you want anyway.

I have an AMD Radeon HD 5870 under Ubuntu and multisampling is not enabled by default with a multisample renderbuffer attached to a FBO. I must call glEnable(GL_MULTISAMPLE) explicitly. On the default framebuffer too I need to explicitly enable multisampling. But unfortunately, since catalyst 11.7 multisampling on the default framebuffer is not working for me.

I see. I didn’t know it was an include safety. Either way, given that I have this opengl extension, shouldn’t I be able to enable multisampling?

After a bit more research, I’m finding SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 2); fails with “Couldn’t find matching GLX visual” when SDL_SetVideoMode() is called. Maybe it’s in my x settings?

Did you set also this:


To get the number of samples available call

On my old computer with nvidia TNT2 with the mesa OpenGL software driver, the extension GL_ARB_multisample was supported but with only one sample per pixel. So check the visual available with glxinfo.In the last column (ms), there is the (ns = number of samples) and (b=number of multisample buffer) listed.

As it turns out, both MULTISAMPLEBUFFERS and MULTISAMPLESAMPLES throw that error. GL_SAMPLES appears to be zero. Maybe my system doesn’t support it?

EDIT: It has zero in both ns and b throughout the entire list. I guess I misinterpreted GL_ARB_MULTISAMPLE being listed as an extension under server, client, GLX, and OpenGL, extensions as supporting it. I do have an integrated graphics card, but it was worth trying. :smiley:

That’s a driver bug then. The spec clearly states that GL_DITHER and GL_MULTISAMPLE are GL_TRUE by default.

Is GL_ARB_multisample unrelated to number of samples and buffer support then?

Multisampling is a function of the framebuffer. However, OpenGL does not define the contents of the default framebuffer; the stuff that initializes an OpenGL context does. So you need to use those APIs to make multisampling possible, and then use what’s in GL_ARB_multisample to activate multisampled rendering.


That’s a driver bug then. The spec clearly states that GL_DITHER and GL_MULTISAMPLE are GL_TRUE by default. [/QUOTE]

So I have at least two driver bugs. I decided to send my problem to the AMD linux driver crew last week. At least, I have another (easy) way to remove jagged edge with FBO.

In essence, I have an opengl extension I can’t use?

Define “can’t use”.

What you can and cannot use is based on what you’re doing. You don’t have to create a multisampled default framebuffer to do multisampled rendering, but you do have to have some framebuffer (whether an FBO or the default) that has multisampled images in it to render with multisampling.

If SDL isn’t able to give you a multisampled framebuffer, then it sounds like you either need to use something else to create your context or build multisampled images manually and use FBOs. You can blit to the non-multisampled default framebuffer.