Handmade Hero » Forums » Code » Question about anti aliasing using the GPU
OliverMarsh
Oliver
62 posts
2 projects

A budding game developer and programmer

#14533 Question about anti aliasing using the GPU
3 months, 1 week ago Edited by Oliver on March 16, 2018, 5:47 a.m. 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!

mmozeiko
Mārtiņš Možeiko
1693 posts
1 project
#14534 Question about anti aliasing using the GPU
3 months, 1 week ago Edited by Mārtiņš Možeiko on March 16, 2018, 6 a.m.

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.
OliverMarsh
Oliver
62 posts
2 projects

A budding game developer and programmer

#14535 Question about anti aliasing using the GPU
3 months, 1 week ago

Thanks Martins for the clarification