Method of Anti-aliasing and some questions about it

Using GLFW
Robert
2013-11-14
2013-11-16
  • Robert

    Robert - 2013-11-14

    I would like to ask how AA (anti aliasing) is implemented in GLFW. I am working more on my text rendering functions and at the stage of trying to implement AA to the whole polygon I'm rending text to.
    However since I cannot turn glfw's AA on and off on the fly I cannot isolate AA to just one specific set of geometry; couple that with the fact I need the whole geometry AA'd it wouldn't be sufficient anyways.

    Also I need this to be as flexible as possible meaning I need it to work with legacy versions of opengl (below opengl 2.0 preferably). Which leads me to the other question for glfw; does it have a version limit for opengl with its AA IE does it require opengl 2.0+ or 3.3+ etc.

    Thanks in advance.

     
  • Doug Binks

    Doug Binks - 2013-11-14

    Anti-aliasing is a complex subject, with many techniques available. You're best reading up on rendering techniques to understand these. OpenGL has APIs for multisample anti-aliasing, and polygon/line edge smoothing. The later is hard to use, and not well accelerated on consumer cards.

    GLFW's API gives a cross platform way to create a back and depth buffer with multisampling through use of the GLFW_SAMPLES window hint. Note that all GLFW does here is to check if the device supports this and enable it on window creation, the rest is up to your graphics driver and OS.

    For text rendering I'd stick to one of the many per-pixel text renderers such as stb_truetype or freetype since these do proper sub-pixel anti-aliasing.

    If you're rendering text as using a texture rendered to a polygon, trying to anti-alias this won't help as only the polygon edges will be anti-aliased. Texture anti-aliasing using alpha to coverage will probably makes things look worse. Signed distance field fonts may be what you're looking for here (link is a decent intro video with the original Valve article link in the notes).

     
    Last edit: Doug Binks 2013-11-14
  • Robert

    Robert - 2013-11-15

    Yea I am using distance fields (before I knew what is was called/read the white paper on it XD).There's reasons why I am writing my own text functions (is better compatibility and flexibility).
    I've got everything in place and the only thing is the AA.
    I've looked up many different algorithms for this case but the majority either use shaders, OS dependencies or tell me to render to a texture twice the size (which using JUST for text seems like it would slow down the applications a bit too much).

    If there isn't any method out there, then I guess it's back to the white board.

    PS so glfw implements a multi-sampling into the window and ties that context to opengl and it's fixed functions?

     
    • Doug Binks

      Doug Binks - 2013-11-15

      GLFW doesn't implement any multisampling, it provides a cross platform API to the OS specific OpenGL APIs for window creation through setting the GLFW_SAMPLES window hint to a non zero value.

       
  • Robert

    Robert - 2013-11-16

    Okay so it just uses the OS's functions
    Thanks :)

     
    Last edit: Robert 2013-11-16

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks