3 ms·
On Windows, the best way is often Direct2D https://docs.microsoft.com/en-us/windows/win32/direct2d/direct2d-portal https://docs.microsoft.com/en-us/windows/win3
by Const-me 5y ago
On Windows, the best way is often Direct2D https://docs.microsoft.com/en-us/windows/win32/direct2d/direct2d-portal https://docs.microsoft.com/en-us/windows/win32/direct2d/dire...
On Linux, you have to do that yourself. The best approach depends on requirements and target hardware.
The simplest case is when your lines are straight segments or polylines of them, you have decent GPU, and you don’t have weird requirements about line caps and joins. In that case, simply render a quad per segment, using 8x or 16x MSAA. Quality-wise, the results at these MSAA levels are surprisingly good. Performance-wise, modern PC-class GPUs (including thin laptops and CPU-integrated graphics in them) are usually OK at that use case even with 16x MSAA.
If MSAA is too slow on your hardware but you still want good quality AA, it’s harder to achieve but still doable. Here’s a relevant documentation from my graphics library for Raspberry Pi4: https://github.com/Const-me/Vrmac/blob/master/Vrmac/Draw/VAA.md https://github.com/Const-me/Vrmac/blob/master/Vrmac/Draw/VAA...
Update: if you only need to support nVidia GPUs, they have a proprietary GL extension nv_path_renreding which does pretty much the same thing as Direct2D, but not exclusive to Windows.
- wly_cdgr 5y agoThank you!