Developer knowledge network · moderated exchange

UnreliableCode қауымдастығы

Әзірлеушілерді зерттеу, кері инженерия және кодтау қауымдастығы

Knowledge indexТірі
4Categories
919Threads
2.8KЖазбалар
Guide

Drawing Smooth Anti-Aliased FOV Circles with ImDrawList::AddCircle [v2.4 Technical Discussion]

imgui_artisan
UI Designer
MEMBER
Өкіл: 202
Қосылу күні: Apr 2019
Хабарламалар: 54
Рахмет: 28
1 ай бұрын · Jul 21, 2026 7:46 AM
#1

How to render ultra-smooth, anti-aliased FOV circles without jagged pixel edges:

CPP
void DrawFOVCircle(ImVec2 center, float radius, ImU32 color, float thickness) {
    ImDrawList* dl = ImGui::GetBackgroundDrawList();
    // Set segment count to 128 for perfectly round circle
    dl->AddCircle(center, radius, color, 128, thickness);
    // Optional: Draw subtle glow aura around circumference
    dl->AddCircle(center, radius + 1.0f, (color & 0x00FFFFFF) | 0x33000000, 128, 2.0f);
}

128 segments ensures the circle remains butter-smooth on 4K monitors.

matrix_math_guy
Math Specialist
MEMBER
Өкіл: 105
Қосылу күні: Aug 2018
Хабарламалар: 52
Рахмет: 41
1 ай бұрын · Jul 21, 2026 11:34 AM
#2

Default ImGui segment count is 32 which looks like a polygon on large radii. 128 segments is perfect.

colorbot_crafter
Hardware Modder
MEMBER
Өкіл: 126
Қосылу күні: Mar 2021
Хабарламалар: 14
Рахмет: 78
1 ай бұрын · Jul 22, 2026 4:09 AM
#3

The glow aura looks incredible on OLED displays.