Handmade Hero»Forums»Code
Oliver Marsh
193 posts / 1 project
Olster1.github.io
Question about anti aliasing using the GPU
Edited by Oliver Marsh on Reason: Initial post
Hello everyone,

I was making a line drawing app and learning about anti-aliasing using openGL, however was getting a bit confused about the options.

First of, I was using a shader to anti-aliase the line using smooth step function with a specified distance from the edge. This worked well but gets more involved when I start trying to draw different shapes. i.e. trying to work out how far a pixel is from the nearest edge of a triangle.

I am now using msaa, which achieves anti-aliasing on the edges without doing any smooth-step. However I noticed msaa is only supported on gl3 and gl4 versions and not on either gl es versions.

With the software renderer I believe we just got anti-aliasing for free by offsetting the pixel start position by a percentage and doing bilinear blending. I thought the GPU would have this same functionality for free (i.e. not using a msaa buffer).

What is the most common technique for anti-aliasing on the GPU?

Any help would be great!

Mārtiņš Možeiko
2562 posts / 2 projects
Question about anti aliasing using the GPU
Edited by Mārtiņš Možeiko on
Actually multisampled rendering is in GL version 1.3 and up (see wikipedia). But MSAA was available before that through ARB_multisample extension, like everything else in GL. You can see that extension was written against GL 1.2 spec. So just check GL version or extension presence and you're good to use it.
Oliver Marsh
193 posts / 1 project
Olster1.github.io
Question about anti aliasing using the GPU
Thanks Martins for the clarification