tags:

views:

291

answers:

6

I'm using the following code in order to antialiase 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 antialiase my application polygons. With the code above, I even enabled blending, but it has no effect. Also the rendering code shouldnt 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 doesnt work.

A: 

Have you got the Antialiasing Settings" in the nVidia control panel set to "Application-Controlled"?

ChrisF
yeah, it works when i force enable, and doesnt work when its application controlled
A: 

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

sixlettervariables
nope, i tried both ways.
Interesting, I'm unable to replicate what you're seeing with any of my code. I've got a hunch the NVidia Control Panel is not being your friend.
sixlettervariables
+2  A: 

do you create your render context with multisampling? that's what nvidia's control panel changes.

Marcus Lindblom
umm, nope, how do i do that?
It depends on your window system / framework, usually there is a 'samples' value you can set to 4 or 8 somewhere. In windows, it goes into the pixel format struct.
Marcus Lindblom
+2  A: 

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: http://stackoverflow.com/questions/1513811/getting-smooth-big-points-in-opengl/1513979#1513979

Mads Elvheim
A: 

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

Raminder
A: 

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.

Adam Rosenfield
geforce 8800GTS should support though