Dear ImGui and GLFW: Cross Platform Desktop GUI Development (C++)

March 5, 2025

Building desktop GUI apps that work consistently across different operating systems presents several technical challenges. Dear ImGui combined with GLFW provides a robust technical stack for cross-platform development. ImGui's immediate mode architecture regenerates the interface each frame, while GLFW handles window creation, input processing, and OpenGL context management across Windows, macOS, and Linux.

This post examines a basic "Hello World" implementation using ImGui and GLFW on the three major desktop platforms. The application demonstrates a simple counter interface with color customization and framerate display.

Below, you'll find screenshots of the application running on Windows, macOS, and Linux. Each screenshot is paired with the corresponding OS task manager and file explorer, showing memory, CPU utilization and file size on different operating systems. These comparisons provide insight into how the same codebase performs across different desktop environments.

Windows

C++ Dear ImGui App Running on Windows
C++ Dear ImGui App Running on Windows

macOS

Ubuntu Linux

C++ Dear ImGui App Running on Ubuntu Linux (in Hyper-V)
C++ Dear ImGui App Running on Ubuntu Linux (in Hyper-V)

From a technical perspective, the ImGui/GLFW approach represents one of two major GUI programming paradigms: immediate mode (used by ImGui) versus retained mode (used by frameworks like GTK, Qt, and WPF).

In immediate mode, the entire UI is regenerated each frame and state is managed by the application, leading to a more direct programming model but potentially higher CPU usage. Retained mode frameworks maintain a persistent widget hierarchy and internal state, which can be more efficient for complex interfaces.

The performance metrics from the task managers reveal this tradeoff. The ImGui application uses more CPU due to constant redrawing. Developers should consider these tradeoffs when choosing between immediate mode libraries like ImGui and traditional retained mode frameworks for cross-platform desktop applications.

Anthony Tietjen

About the Author

Anthony Tietjen is a software engineer with experience across desktop, mobile, and web development. Husband and father, with a passion for music and the outdoors. Connect with Anthony on LinkedIn and X/Twitter

About StratusCube

StratusCube makes software for everyday use along with software engineering articles. If you enjoined this article, please take a moment to browse our apps or check out more articles .