explaingit

joeydevries/learnopengl

12,439C++Audience · developerComplexity · 3/5Setup · moderate

TLDR

Code samples for the Learn OpenGL book and website, organized by chapter so you can follow along while learning 2D and 3D graphics programming in C++ and OpenGL.

Mindmap

mindmap
  root((LearnOpenGL))
    What It Is
      Book code samples
      Chapter by chapter
      C++ and OpenGL
    Build Setup
      CMake build
      Windows prebuilt libs
      Linux and macOS
    Topics Covered
      Shaders
      Textures
      Lighting
      3D rendering
    Audience
      Graphics learners
      C++ developers
    Related
      Glitter project
      Rust port
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Run working code alongside each Learn OpenGL book chapter to reinforce graphics programming concepts

USE CASE 2

Study specific OpenGL topics like shaders, textures, or lighting by reading isolated per-chapter examples

USE CASE 3

Use the included CMake setup as a template for starting your own C++ OpenGL project

USE CASE 4

Experiment with individual chapters without managing all dependencies using the Glitter companion project

Tech stack

C++CMakeOpenGL

Getting it running

Difficulty · moderate Time to first run · 30min

On Linux and macOS, required libraries must be installed via a package manager before CMake can build the project.

In plain English

This repository contains the code samples that accompany the Learn OpenGL book and its companion website at learnopengl.com. OpenGL is a programming interface for rendering 2D and 3D graphics, used in games, simulations, and visualizations. The repository is organized by chapter so that readers can follow along with the book while having the working code beside them. The project is written in C++ and uses CMake to handle building across different operating systems. On Windows, the necessary libraries are pre-compiled and included in the repository so that setup requires only running the CMake script and generating a project file. On Linux and macOS, the libraries need to be installed first through a package manager, and then the standard CMake build steps apply. Instructions for all three platforms are provided in the README. For people who find the library setup process difficult, there is a separate project called Glitter, mentioned in the README, that bundles everything needed to run a single LearnOpenGL chapter into one simple starting point. This can make it easier to experiment with individual examples without managing all the dependencies manually. The repository is purely a learning resource. It does not provide a library to install or an application to run on its own. Each chapter's code demonstrates a specific concept in graphics programming. A community-maintained port of the same examples in the Rust language is also linked from the README.

Copy-paste prompts

Prompt 1
I am following the LearnOpenGL chapter on lighting, help me understand why my normals look wrong in this C++ and OpenGL code
Prompt 2
Using the LearnOpenGL CMake project structure, help me add a new chapter directory that compiles on Windows
Prompt 3
Based on the LearnOpenGL texture chapter, show me how to load a PNG file and apply it to a quad in OpenGL with C++
Prompt 4
Help me debug why my LearnOpenGL shadow mapping example renders all black on Linux with GLFW and GLAD
Open on GitHub → Explain another repo

← joeydevries on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.