Skip to main content

Overview

This guide will help you create your first Dear ImGui application. We’ll build a simple “Hello World” program that displays a window with some basic widgets.
This quickstart uses GLFW for windowing and OpenGL 3 for rendering, which work on Windows, macOS, and Linux. For other platforms or graphics APIs, see the Integration Guide.

Prerequisites

Before you begin, ensure you have:
  • A C++ compiler (C++11 or later)
  • GLFW library
  • OpenGL 3.0+ support

Installation

1

Download Dear ImGui

Clone or download Dear ImGui from GitHub:
The core library files are:
  • imgui.cpp, imgui.h
  • imgui_demo.cpp
  • imgui_draw.cpp
  • imgui_tables.cpp
  • imgui_widgets.cpp
  • imconfig.h (configuration)
2

Get the backends

For this quickstart, you’ll need:
  • backends/imgui_impl_glfw.cpp + imgui_impl_glfw.h (platform backend)
  • backends/imgui_impl_opengl3.cpp + imgui_impl_opengl3.h (renderer backend)
3

Install GLFW

Your First Dear ImGui Program

Create a file called main.cpp with the following code:
main.cpp

Building Your Application

Run Your Application

Execute your compiled program:
You should see a window with:
  • A demo window showcasing Dear ImGui features
  • A “Hello, World!” window with a slider, color picker, and button
  • Smooth 60 FPS rendering
Press Ctrl+Click on any slider to type in a value directly!

Understanding the Code

Let’s break down the key parts:

Initialization

  • IMGUI_CHECKVERSION() ensures your headers match the compiled library
  • CreateContext() initializes Dear ImGui’s internal state
  • GetIO() provides access to input/output configuration

Frame Loop

Every frame follows this pattern:
  1. Start a new Dear ImGui frame
  2. Create your UI with ImGui calls
  3. Render the draw data

Creating UI

Dear ImGui functions return values when interaction happens:
  • Button() returns true when clicked
  • Checkbox() modifies the bool and returns true when changed
  • Begin() / End() define a window scope

Next Steps

Integration Guide

Learn how to integrate Dear ImGui into your existing project

Core Concepts

Understand the immediate mode paradigm

Widgets Overview

Explore all available widgets

Examples

Browse 30+ complete example applications

Common Issues

Make sure you’re calling:
  1. ImGui::NewFrame() at the start of each frame
  2. ImGui::Render() after your UI code
  3. ImGui_ImplXXX_RenderDrawData(ImGui::GetDrawData()) to draw
Your headers don’t match the compiled version. Make sure all Dear ImGui files are from the same version.
The font texture wasn’t uploaded. Most backends handle this automatically, but you may need to call ImGui_ImplXXX_CreateFontsTexture().
Always call ImGui::End() regardless of the return value from Begin(). This is a common beginner mistake.
Explore the full Demo Window (ImGui::ShowDemoWindow()) to see all features in action with interactive examples and code snippets!