Newbie
Newbie

Reputation:

OpenGL antialiasing isn't working

I'm using the following code in order to antialias only the edges of my polygons:

glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
glEnable(GL_POLYGON_SMOOTH);

But it doesn't work.

I can force enable antialiasing by the nvidia control panel, and it does antialias my application polygons. With the code above, I even enabled blending, but it has no effect. Also the rendering code shouldn't be changed since the nvidia control panel can turn it on, and it certainly cant modify my rendering code, it must be some on/off flag. What is it?

I've heard of "multisampling", but I don't need that.

Edit: the nvidia control panel setting is "application controlled" when it doesn't work.

Upvotes: 1

Views: 5656

Answers (4)

Adam Rosenfield
Adam Rosenfield

Reputation: 400572

Most likely, your hardware does not support it. Not all OpenGL implementations support antialiased polygons; see the OpenGL FAQ. I've definitely run into this problem before on a first-generation MacBook -- its GPU, the Intel GMA 950, does not support antialiased polygons.

Upvotes: 0

Raminder
Raminder

Reputation: 1887

Try enabling blending

glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE);
glEnable(GL_BLEND);
glEnable(GL_POLYGON_SMOOTH);

Also following article might help

http://www.edm2.com/0603/opengl.html

Upvotes: 0

Mads Elvheim
Mads Elvheim

Reputation:

You need to ask for a visual/pixelformat with support for multisampling. This is an attribute in the attribute list you pass to glXChooseFBConfig when using GLX/XLib, and wglChoosePixelformatARB when using the Win32 API. See my post here: Getting smooth, big points in OpenGL

Upvotes: 2

user7116
user7116

Reputation: 64118

It may be that your glEnable call is after the glHint call.

Upvotes: 0

Related Questions