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 开发者_Python百科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.
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
It may be that your glEnable
call is after the glHint
call.
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
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.
精彩评论