Class-OpenGL
C++17 · OpenGL 3.3 Core

An engine you can read in an afternoon.

RAII wrappers around every GL resource, a GLCall check on every call, and thirteen small examples that each isolate one rendering technique.

Procedural rose rendered with the engine, golden-angle petals and ACES tone mapping

What is inside

Small surface area, explicit ownership, no hidden global state beyond the renderer backend.

RAII everywhere

Programs, buffers, VAOs, textures, cubemaps and framebuffers delete themselves. Copying is deleted, moving is enabled.

Checked calls

Every GL call goes through GLCall, which prints file:line call error code and breaks in Debug builds.

Two backends

Switch between the real OpenGL backend and a headless Null backend at runtime, with per-frame draw statistics.

Modern shading

Blinn-Phong and Cook-Torrance PBR, shadow maps with PCF, HDR with bloom, skybox and post-processing chains.

Thirteen examples

From a hardcoded triangle to a procedural rose, each example adds one capability without rewriting the previous one.

Headless tests

Camera math and OBJ import are unit-tested without a GL context, with a coverage floor enforced in CI.

Selected examples

Screenshots captured on macOS / Apple M4 with 4× MSAA.

Build in three commands

Requires CMake ≥ 3.16 and a C++17 compiler. GLFW and glm are fetched automatically.

Build and run

git clone https://github.com/UnmetDecade/Class-OpenGL.git
cd Class-OpenGL
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build -j
ctest --test-dir build --output-on-failure
./build/13_rose

Platform notes

macOS works out of the box. On Linux install xorg-dev and libgl1-mesa-dev first. Windows is built with MinGW or MSVC; see the README for details.

Documentation: README, architecture rules, changelog.