Anti-Aliasing in OpenGL [C++]

I'm trying to make anti-aliasing work inside of OpenGL, here's what I've tried:

glEnable(GL_POINT_SMOOTH);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glEnable(GL_POLYGON_SMOOTH);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);


But so far none of these have worked.

I have gotten antialiasing to work by enabling it on the control panel for my video card (Catalyst Control Center in my case), but I would like to get it working inside my program instead.

1. This is what the rendering looks like with 4x antialiasing enabled via the video card control panel:
2. And this is what it looks like when I do it with my program:

How do I get antialiasing to work?

• How about a screenshot of what you're getting, and what you are expecting to get? – Panda Pajama Aug 25 '14 at 18:32
• Also, what is CCC? – Panda Pajama Aug 25 '14 at 18:33
• CCC is the control panel for AMD graphics cards. (Catalyst Control Center IIRC) Here's a screenshot with AA on (by turning it on in CCC): imgur.com/xoPkJg8 Here's one without: imgur.com/wxf0dGs – gie005 Aug 25 '14 at 19:00
• You're trying to use rasterization antialiasing, which, although I've never used it, seems to be slow, and pretty much obsolete. You should probably use multisampling antialiasing instead. – Panda Pajama Aug 26 '14 at 3:12

To get better results you will need to check for MSAA (http://www.opengl.org/wiki/Multisampling)

Define how many samples you want for Anti-Aliasing in WGL_SAMPLES_ARB attribute passed to the function wglChoosePixelFormatARB (for Windows).

You can find code for that here :

http://nehe.gamedev.net/tutorial/fullscreen_antialiasing/16008/

This paper is also worth reading for Anti-Aliasing :

http://www.cse.iitb.ac.in/~paragc/teaching/2009/cs475/notes/antialiasing_sumair.pdf

• Tried doing both, none had any effect sadly. – gie005 Aug 25 '14 at 21:57
• @gie005 If you can force-enable it through your GPU driver, you should be able to request it through OpenGL. Make sure you didn't force-disable it through CCC; AA Mode and AA Samples should be set to "Use application settings". If that's the case there's probably a problem with your context initialization code. – bcrist Aug 26 '14 at 4:44
• Note that Nehe's tutorials are ancient (still made in the time of the fixed function pipeline) and though some (most) of the tricks still work there are usually different and better ways now. – Roy T. Aug 26 '14 at 8:13
• @RoyT. is right about outdated NeHe tutorials. Code for various platforms is also provided in the first wiki link I gave. – Manmohan Bishnoi Aug 27 '14 at 11:21