- OpenGL 3.3+ rendering
- GLFW window management
- GLAD OpenGL loader
- STB image loading support
- Meson build system
- C++17 standard
Before building, ensure you have the following installed:
- C++ compiler with C++17 support (GCC 7+, Clang 5+, or MSVC 2017+)
- Meson build system (0.55.0 or later)
- Ninja build tool
- GLFW3 development libraries
- OpenGL development libraries
Option 1: MSYS2 (Recommended)
# Install MSYS2 from https://www.msys2.org/
# Then in MSYS2 MinGW64 terminal:
pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-meson mingw-w64-x86_64-ninja mingw-w64-x86_64-glfwOption 2: Visual Studio
- Install Visual Studio 2017 or later with C++ support
- Install Python 3.7+ from https://www.python.org/
- Install Meson and Ninja:
pip install meson ninja
- Install vcpkg and GLFW:
git clone https://github.com/Microsoft/vcpkg.git cd vcpkg .\bootstrap-vcpkg.bat .\vcpkg install glfw3:x64-windows - Set environment variable or use
--pkg-config-pathwhen configuring
Option 3: Chocolatey
choco install python meson ninja
# Then install GLFW manually or via vcpkgsudo apt update
sudo apt install build-essential meson ninja-build libglfw3-dev libgl1-mesa-dev libx11-devsudo dnf install gcc-c++ meson ninja-build glfw-devel mesa-libGL-devel libX11-develsudo pacman -S base-devel meson ninja glfw-x11 mesa libx11brew install meson ninja glfw.
├── src/ # Application source files (.cpp)
├── include/ # Header files
├── external/
│ ├── glad/ # GLAD OpenGL loader
│ │ ├── include/
│ │ └── src/
│ └── stb_image/ # STB image loading library
├── meson.build # Build configuration
└── README.md
Linux/macOS:
meson setup buildWindows (MSYS2):
meson setup buildWindows (Visual Studio):
meson setup build --backend=vs
# Or for Ninja backend:
meson setup buildWindows (with vcpkg):
meson setup build --pkg-config-path=C:\path\to\vcpkg\installed\x64-windows\lib\pkgconfigLinux/macOS/Windows (MSYS2):
meson compile -C buildOr using Ninja directly:
ninja -C buildWindows (Visual Studio):
Open build/opengl-app.sln in Visual Studio and build, or use:
meson compile -C buildLinux/macOS:
./build/appWindows:
.\build\app.exeOr in MSYS2:
./build/app.exeThe build system generates compile_commands.json for IDE integration (clangd, IntelliSense, etc.).
Linux/macOS/Windows (MSYS2):
rm -rf build
meson setup build
meson compile -C buildWindows (PowerShell/CMD):
rmdir /s /q build
meson setup build
meson compile -C build- GLFW3: Cross-platform window and input handling
- OpenGL: Graphics API (opengl32 on Windows, GL on Linux, OpenGL framework on macOS)
- GLAD: OpenGL function loader
- STB Image: Image loading library
- threads: Threading library (POSIX threads on Unix, Windows threads on Windows)
- Linux: dl (dynamic linking), X11 (X Window System)
- Windows: opengl32 (OpenGL library)
- macOS: OpenGL framework
- C++ Standard: C++17
- Warning Level: 3 (high warnings enabled)
- GLAD built with reduced warnings (
-Wno-pedantic)
- Linux: Full support with X11
- Windows: Full support (MSVC, MinGW, MSYS2)
- macOS: Full support with Cocoa and OpenGL framework