4
\$\begingroup\$

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:

AA working AA not working

How do I get antialiasing to work?

\$\endgroup\$
4
  • 2
    \$\begingroup\$ How about a screenshot of what you're getting, and what you are expecting to get? \$\endgroup\$ Commented Aug 25, 2014 at 18:32
  • \$\begingroup\$ Also, what is CCC? \$\endgroup\$ Commented Aug 25, 2014 at 18:33
  • 1
    \$\begingroup\$ 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 \$\endgroup\$
    – gie005
    Commented Aug 25, 2014 at 19:00
  • 3
    \$\begingroup\$ 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. \$\endgroup\$ Commented Aug 26, 2014 at 3:12

1 Answer 1

5
\$\begingroup\$

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

\$\endgroup\$
4
  • \$\begingroup\$ Tried doing both, none had any effect sadly. \$\endgroup\$
    – gie005
    Commented Aug 25, 2014 at 21:57
  • 1
    \$\begingroup\$ @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. \$\endgroup\$
    – bcrist
    Commented Aug 26, 2014 at 4:44
  • \$\begingroup\$ 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. \$\endgroup\$
    – Roy T.
    Commented Aug 26, 2014 at 8:13
  • \$\begingroup\$ @RoyT. is right about outdated NeHe tutorials. Code for various platforms is also provided in the first wiki link I gave. \$\endgroup\$ Commented Aug 27, 2014 at 11:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .