Developer knowledge network · moderated exchange

Społeczność UnreliableCode

Badania programistów, inżynieria wsteczna i społeczność programistów

Knowledge indexNa żywo
4Categories
919Threads
2.8KPosty
Guide

Drawing Smooth Anti-Aliased FOV Circles with ImDrawList::AddCircle

imgui_artisan
UI Designer
MEMBER
Rozpustnik: 202
Data dołączenia: Apr 2019
Posty: 54
Dzięki: 28
1 miesięcy temu · Jul 20, 2026 1:08 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
Rozpustnik: 105
Data dołączenia: Aug 2018
Posty: 52
Dzięki: 41
1 miesięcy temu · Jul 20, 2026 5:39 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
Rozpustnik: 126
Data dołączenia: Mar 2021
Posty: 14
Dzięki: 78
1 miesięcy temu · Jul 20, 2026 3:41 PM
#3

The glow aura looks incredible on OLED displays.