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 8 of 8

Thread: AntiAliasing

  1. #1
    Advanced Member Frequent Contributor
    Join Date
    Dec 2005
    Location
    Italy
    Posts
    655

    AntiAliasing

    Hi All,

    Is it possible that anti-aliasing is active on an OpenGL viewport even if you didn't request it? For example forcing it in the Windows graphics adapter settings?

    Is there a way to create a viewport *without* anti-aliasing even in this scenario?

    Thanks,

    Alberto

  2. #2
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948

    Re: AntiAliasing

    Is it possible that anti-aliasing is active on an OpenGL viewport even if you didn't request it? For example forcing it in the Windows graphics adapter settings?
    Yes.

    Is there a way to create a viewport *without* anti-aliasing even in this scenario?
    No. Well, it depends.

    If the driver wants a multisampled framebuffer, you will get a multisampled framebuffer. There's nothing you can do about that. However, FBOs are another matter entirely.

    If you want to force no multisampling, your first step is to detect if the driver has given you a multisampled default framebuffer. I believe glGetIntegerv(GL_SAMPLES) will be 0 if not multisampled.

    If it is multisampled, you can do one of two things. You can display a pop-up that politely asks the user to stop forcing multisampled display. Or you can do it behind their back.

    Create color and depth/stencil renderbuffers the size of the window. These should not be multisampled, and these are what you will render to. At the end of the frame, before swapping buffers, do a blit from these renderbuffers to the multisample default buffer. Blits from singlesample to multisample will cause each pixel to be copied into the multiple samples. So the eventual multisample reduction on swapping will result in the same thing it started out with.

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Dec 2005
    Location
    Italy
    Posts
    655

    Re: AntiAliasing

    Thanks Alfonse for the detailed answer. I thought that the workaround was easier than that.

    I need this not anti-aliased viewport to perform selection using the object ID encoded in the object color, then I read the pickBox bitmap and look for object id in every pixel color. The problem is that if the antialiasing is active I get some pixels with values not in the range 0-maxObjectCount and the procedure fails.

    Do you know any other workaround for this issue?


    Thanks so much again,

    Alberto

  4. #4
    Member Regular Contributor
    Join Date
    Mar 2003
    Location
    Los Angeles
    Posts
    374

    Re: AntiAliasing

    Quote Originally Posted by devdept
    I need this not anti-aliased viewport ...
    Do you know any other workaround for this issue?
    I also need to generate anti-aliased OpenGL scenes in cases where I render a scene, read the image back into an array (with glReadPixels) then do some statistical analysis on the image. This 'analysis' is usually something simple like counting how many pixels of a certain color are in the image. I must have no anti-aliasing or dithering. I also turn off lighting and apply simple coloring to objects. That way I know EXACTLY what RGB values to expect on each pixel.

    Your video card has settings that you can change to make sure AA and dithering are off. When porting one of my apps to a coworker's laptop a few years ago, we found that his video card would dither at the screen resolution needed by my sim. Our workaround was to lower his screen rez just enough to get the pixel depth we needed to avoid dithering. Part of my sim was off the screen, but enough of it was visible to accomplish the image processing. (This is probably where off-screen rendering might come in handy

    On a Windows computer, go to:
    1) Start
    2) Control Panel
    3) Display
    4) Settings
    5) Advanced
    6) Graphics card tab which should allow you to
    turn anti-aliasing off
    Am I doing your homework for you?

  5. #5
    Intern Contributor
    Join Date
    Feb 2010
    Posts
    59

    Re: AntiAliasing

    Quote Originally Posted by MaxH
    Quote Originally Posted by devdept
    I need this not anti-aliased viewport ...
    Do you know any other workaround for this issue?
    I also need to generate anti-aliased OpenGL scenes in cases where I render a scene, read the image back into an array (with glReadPixels) then do some statistical analysis on the image. This 'analysis' is usually something simple like counting how many pixels of a certain color are in the image. I must have no anti-aliasing or dithering. I also turn off lighting and apply simple coloring to objects. That way I know EXACTLY what RGB values to expect on each pixel.
    i had draw a cube.
    it looks like this.

    and i rotated it
    like this

  6. #6
    Advanced Member Frequent Contributor
    Join Date
    Dec 2005
    Location
    Italy
    Posts
    655

    Re: AntiAliasing

    Hi Alfonse,

    What about discarding pixels with alpha different from one? Will it help to get only right object IDs even if the AntiAliasing is forced via Windows control panel settings?

    Thanks,

    Alberto

  7. #7
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948

    Re: AntiAliasing

    What about discarding pixels with alpha different from one? Will it help to get only right object IDs even if the AntiAliasing is forced via Windows control panel settings?
    Alpha has nothing to do with multisample antialiasing.

  8. #8
    Advanced Member Frequent Contributor
    Join Date
    Dec 2005
    Location
    Italy
    Posts
    655

    Re: AntiAliasing

    I see, thanks.

    Alberto

Posting Permissions

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