imgui

Framework

ocornut/imgui

Bloat-free C++ GUI library for rapid tool development.

Overview

Dear ImGui is an immediate-mode GUI library for C++ that focuses on simplicity and productivity. It is designed for game engines, real-time 3D applications, and content creation tools. It provides minimal state synchronization and is self-contained with no external dependencies.

README Preview

Dear ImGui\n=====\n\n"Give someone state and they'll have a bug one day, but teach them how to represent state in two separate locations that have to be kept in sync and they'll have bugs for a lifetime." -ryg\n\n----\n\n[](https://github.com/ocornut/imgui/actions?workflow=build) [](https://github.com/ocornut/imgui/actions?workflow=static-analysis) [](https://github.com/ocornut/imgui_test_engine/actions?workflow=tests)\n\n(This library is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addition to maintenance and stability there are many desirable features yet to be added. If your company is using Dear ImGui, please consider reaching out.)\n\nBusinesses: support continued development and maintenance via invoiced sponsoring/support contracts:\n  _E-mail: contact @ dearimgui dot com_\nIndividuals: support continued development and maintenance [here](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WGHNC6MBFLZ2S). Also see [Funding](https://github.com/ocornut/imgui/wiki/Funding) page.\n\n| [The Pitch](#the-pitch) - [Usage](#usage) - [How it works](#how-it-works) - [Releases & Changelogs](#releases--changelogs) - [Demo](#demo) - [Getting Started & Integration](#getting-started--integration) |\n:----------------------------------------------------------: |\n| [Gallery](#gallery) - [Support, FAQ](#support-frequently-asked-questions-faq) -  [How to help](#how-to-help) - **[Funding & Sponsors](https://github.com/ocornut/imgui/wiki/Funding)** - [Credits](#credits) - [License](#license) |\n| [Wiki](https://github.com/ocornut/imgui/wiki) - [Extensions](https://github.com/ocornut/imgui/wiki/Useful-Extensions) - [Language bindings & framework backends](https://github.com/ocornut/imgui/wiki/Bindings) - [Software using Dear ImGui](https://github.com/ocornut/imgui/wiki/Software-using-dear-imgui) - [User quotes](https://github.com/ocornut/imgui/wiki/Quotes) |\n\n### The Pitch\n\nDear I

FAQ (5)

Troubleshooting
Why do Dear ImGui table columns get scrambled after adding columns or restarting with saved .ini settings?

This affects non-reorderable tables in Dear ImGui 1.93.0 WIP. Stale DisplayOrder values are retained when columns are reconciled or loaded from settings, causing old and new columns to sort incorrectly—especially with bare .ini entries that have no saved column data.

Upgrade to a version containing commit 68bd43b, or apply this fix in TableFixDisplayOrder():

void ImGui::TableFixDisplayOrder(ImGuiTable* table)
{
    if ((table->Flags & ImGuiTableFlags_Reorderable) == 0)
    {
        for (int n = 0; n < table->ColumnsCount; n++)
            table->DisplayOrderToIndex[n] = table->Columns[n].DisplayOrder = (ImGuiTableColumnIdx)n;
        return;
    }

    ImGuiContext& g = *GImGui;
    // existing reorderable-table logic...
}

For tables without ImGuiTableFlags_Reorderable, columns are then always displayed in declaration/index order. Column widths and other per-column data continue to be matched by ID. Note that programmatic reordering of a non-Reorderable table is no longer preserved after this change.

GitHub Issue #9570
Troubleshooting
Why doesn't IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION disable stb_truetype in Dear ImGui?

IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION only disables the linkable implementation contents of stb_truetype.h; it does not disable ImGui's stb_truetype font backend. Update Dear ImGui to a revision containing commit 4989b4c, then add this to imconfig.h or your compiler defines:

#define IMGUI_DISABLE_STB_TRUETYPE 1

Do not define IMGUI_ENABLE_STB_TRUETYPE. Defining IMGUI_ENABLE_FREETYPE also prevents stb_truetype from being enabled by default, but is unnecessary if you are using a custom font loader.

On older versions, patch the default-selection block in imgui_internal.h:

#if !defined(IMGUI_ENABLE_FREETYPE) && !defined(IMGUI_ENABLE_STB_TRUETYPE) && !defined(IMGUI_DISABLE_STB_TRUETYPE)
#define IMGUI_ENABLE_STB_TRUETYPE
#endif

Then define IMGUI_DISABLE_STB_TRUETYPE and rebuild.

GitHub Issue #9573
Troubleshooting
How to fix Dear ImGui AddRect outline being 1 pixel shorter than AddRectFilled?

When drawing a filled rectangle and an outline with the same p_min/p_max, the stroked bottom edge can rasterize one pixel above the filled bottom edge. For a default 1-pixel border, extend only the outline's maximum Y coordinate by 1 pixel:

draw_list->AddRectFilled(pmin, pmax, fill_color);
draw_list->AddRect(pmin, pmax + ImVec2(0.0f, 1.0f), border_color);

Keep pmax unchanged for AddRectFilled. This aligns the visible bottom border with the filled rectangle. AddCircle/AddCircleFilled are not affected because they use the same radius-based geometry.

GitHub Issue #6971
How-to
How to add an icon to a MenuItem in Dear ImGui?

The recommended approach is merging an icon font (e.g., FontAwesome) into your font atlas: set ImFontConfig::MergeMode = true when loading the icon font, then embed icon glyphs directly in the menu label text (e.g., ImGui::MenuItem(ICON_FA_SAVE " Save")). See misc/fonts/README.txt for detailed instructions. Alternatively, the internal MenuItemEx() function accepts an icon parameter separately. For image-based icons, you can render a texture manually next to the item using SameLine() followed by Image((void*)texture_id, ImVec2(16,16)), though this requires modifying the widget or custom layout code and is less flexible than the icon font approach.

GitHub Issue #2582
Troubleshooting
Why does filling a polygon with parallel AddLine() calls look pale or washed out in Dear ImGui 1.93.0?

In ImGui 1.93.0, AddLine() uses anti-aliased strokes by default. When adjacent parallel lines are drawn to scan-fill an area (odd/even line-scan fill), the semi-transparent AA fringes overlap and blend, making the fill appear faded. Fix: pass ImDrawFlags_StrokeLegacy to disable the AA fringe on those strokes:

draw->AddLine(as, bs, color, 1.0f, ImDrawFlags_StrokeLegacy);

This restores the pre-1.93 solid stroke behavior and the expected fill color. Note this is a usage limitation, not a bug; for general/concave polygons consider ImGui's convex fill APIs if holes are not required.

GitHub Issue #9585