Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: antialiasing polygon edges

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2007
    Location
    Ottawa, Canada
    Posts
    18

    antialiasing polygon edges

    Hi

    I am writing a small app using opengl. But I have run into a problem with 'jaggies' on the edges of my polygons.

    I have no problem antaliasing points and lines, but after searching this site, have found nothing here that seems to work in antialiasing the edges of the polygons when i try it in my code.

    I've tried the technique of turning off depth testing, starting with a black, alpha-0 screen, and painting my polygons from back to front using glBlendFunc(GL_SRC_ALPHA_SATURATE, GL_ONE);
    to no avail.

    Any reasons why the antialias may not be working, and does anyone have some suggestions or tricks I might try to get this to work?


  2. #2
    Junior Member Regular Contributor
    Join Date
    Aug 2009
    Location
    Poland
    Posts
    109

    Re: antialiasing polygon edges

    Get opengl context with multisampling, in glx add this to requested attributes:
    GLX_SAMPLE_BUFFERS, 1,
    GLX_SAMPLES, 4

    it should give You 4x antialiasing, wgl should have similar constants. (something like WGL_SAMPLE_BUFFERS and WGL_SAMPLES (not sure, i'm not using Windows anymore)).
    If You are using glut afaik there is no way to create window with ms, but freeglut has support for multisampling.

    You can force antialiasing in graphics driver control panel (at least in NV on linux)

  3. #3
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    2,882

    Re: antialiasing polygon edges

    Quote Originally Posted by kowal
    Get opengl context with multisampling, in glx add this to requested attributes:
    GLX_SAMPLE_BUFFERS, 1,
    GLX_SAMPLES, 4

    it should give You 4x antialiasing,
    Also, don't forget to enable multisample rasterization: glEnable( GL_MULTISAMPLE ).

    If You are using glut afaik there is no way to create window with ms, but freeglut has support for multisampling.
    Right:
    glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE | GLUT_MULTISAMPLE);

    You can force antialiasing in graphics driver control panel (at least in NV on linux)
    Yeah, or just put this env var in the environment before you create your GL context (e.g. via putenv):

    __GL_FSAA_MODE=5

    To query the AA modes available for your card:

    nvidia-settings --query=fsaa --verbose

    See the NVidia driver README for details.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •