Skip to main content

Graphics Stack: From Low-Level Graphics APIs to High-Level GUI Framework

Modern GUI applications are built on following tech aspects:

  • Hardware
    • GPU, Hardware Rendering
    • CPU, Software Rendering
  • Graphic APIs (communicate with the Graphic Card)
    • OpenGL
    • Vulkan
    • DirectX
    • Metal
  • Rendering Engine (Leverage Graphic APIs)
    • GPU, Hardware Rendering
      • Skia (2D) + OpenGL, Vulkan, DirectX, Metal
      • Qt (3D) + OpenGL, Vulkan, DirectX, Metal
      • Cairo + OpenGL
    • CPU, Software Rendering
      • QT Rasterization Engine
      • Skia + CPU
      • Cairo + CPU
  • Windowing System/Compositor
    • Quartz Compositor(OSX)
    • Desktop Window Manager(Windows)
    • X11(Linux)
    • Wayland(Linux)
    • SurfaceFlinger(Android)

Graphics APIs

These are used to render 2D/3D graphics, directly interfacing with GPU.

APIPlatform SupportDescription
OpenGLCross-platform (Windows, macOS, Linux)Legacy but widely supported; immediate mode and programmable pipeline.
VulkanCross-platform (modern)Low-level, high-performance successor to OpenGL. More control, more complexity.
DirectXWindows, XboxMicrosoft's proprietary graphics API. Most used in Windows gaming/device.
MetalmacOS and iOSApple’s graphics API on Apple gaming/device.

These APIs don't create windows or GUI elements — they render within a surface (window) provided by the OS or another toolkit.

Rendering Engine

QT, Unity, Unreal are GUI framework, but they also have their own rendering stacks or rendering engines to draw their UI and visuals.

Rendering EngineUses Which Graphics APIPrimary UseKey Platform(s)
CairoOpenGL2D graphics rendering (software)used by GTK, GIMP, Pango
SkiaOpenGL, Vulkan2D graphics renderingChrome, Android, Flutter
QT own stackOpenGL, Vulkan, DirectX, or Metal2D/3D graphics renderingCross-platform
Unity own stackOpenGL, Vulkan, DirectX, or Metal2D/3D graphics renderingCross-platform
Unreal own stackOpenGL, Vulkan, DirectX, or Metal2D/3D graphics renderingCross-platform

GUI Framework Toolkits

These provide buttons, windows, text inputs, etc. Some of them can also handle rendering.

ToolkitUses Which Graphics APIPlatform SupportNotes
GTKOpenGL via Cairo or GSKLinux, Windows, macOSUsed in GNOME desktop. Not as OpenGL/Vulkan-native as Qt.
QtOpenGL, Vulkan, DirectX, or MetalCross-platformPowerful C++ toolkit with widgets and OpenGL support. Can integrate with OpenGL directly.
UnityOpenGL, Vulkan, DirectX, or MetalCross-platform2D/3D GUI framework for games, AR/VR, and now cross-platform apps
UnrealOpenGL, Vulkan, DirectX, or MetalCross-platform2D/3D GUI framework for games, AR/VR, and now cross-platform apps

Windowing Systems(OS Layers)

These provide surfaces or contexts for rendering, and handle input like mouse/keyboard.

SystemPlatformRelationship
X11Linux/UnixLegacy windowing system. You render OpenGL inside an X11 window.
WaylandLinux (modern)Newer alternative to X11. More modern, secure.
Apple Quartz / MetalKit / CocoamacOSApple dropped OpenGL support in favor of Metal. GUI apps are written with Cocoa (Objective-C/Swift), Metal handles rendering.
Windows GDI / DWMWindowsDirectX and GDI share surfaces; modern Windows apps often use DirectX for acceleration.

It's very essential to apply the native Windowing System library for Cross-platform GUI framework in different platforms. Here's a cue from including native windowing system headers from GLFW

#if !defined(GLFW_NATIVE_INCLUDE_NONE)
#if defined(GLFW_EXPOSE_NATIVE_WIN32) || defined(GLFW_EXPOSE_NATIVE_WGL)
/* This is a workaround for the fact that glfw3.h needs to export APIENTRY (for
* example to allow applications to correctly declare a GL_KHR_debug callback)
* but windows.h assumes no one will define APIENTRY before it does
*/
#if defined(GLFW_APIENTRY_DEFINED)
#undef APIENTRY
#undef GLFW_APIENTRY_DEFINED
#endif
#include <windows.h>
#elif defined(GLFW_EXPOSE_NATIVE_COCOA) || defined(GLFW_EXPOSE_NATIVE_NSGL)
#if defined(__OBJC__)
#import <Cocoa/Cocoa.h>
#else
#include <ApplicationServices/ApplicationServices.h>
#include <objc/objc.h>
#endif
#elif defined(GLFW_EXPOSE_NATIVE_X11) || defined(GLFW_EXPOSE_NATIVE_GLX)
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
#elif defined(GLFW_EXPOSE_NATIVE_WAYLAND)
#include <wayland-client.h>
#endif

Visualizing the Relationships Between Graphic Stacks

Here’s how it all connects:

Your App (Qt / Skia)

GUI Toolkit (Qt / GTK / Skia)

Window System (X11 / AppleKit / Win32)

Graphics API (OpenGL / Vulkan / DirectX)

GPU renders pixels to screen

Bonus: Examples In Practice

PlatformToolkitWindow SystemGraphics API
Linux + KDEQtX11 or WaylandOpenGL/Vulkan
Windows GameCustom / DirectX GUIWin32DirectX
macOS AppCocoa (SwiftUI/UIKit)QuartzMetal
Cross-platform AppQt + SkiaPlatform-nativeOpenGL/Vulkan/Metal

References

Windowing system - Wikipedia

GUI Under Linux | Baeldung on Linux

GTK - Wikipedia

A Comparison of Modern Graphics APIs

Android graphics

  • SurfaceFlinger
  • Skia

Graphics  |  Android Open Source Project Android Graphics Internals - Stack Overflow

WayLand

What is Wayland? · Writing Wayland clients

The Hello Wayland Tutorial | FLOSS & Cia

How to use Wayland with C to make a Linux app | by Sergey Bugaev | Medium