Skip to content

Gallections/LearnOpenGL

Repository files navigation

LearnOpenGL

A comprehensive learning repository for OpenGL graphics programming in C++, following modern OpenGL practices (OpenGL 3.3+). This project contains implementations of various OpenGL concepts, from basic window creation to advanced rendering techniques.

Overview

This repository simply documents my hands-on learning journey and exercises covering fundamental OpenGL topics. Each example is self-contained and demonstrates specific OpenGL concepts with detailed comments and notes. Most of the code for now are direclty associated with units from learnopengl.com.

Table of Contents

Project Structure

The codebase has been refactored into a structured layout to cleanly separate assets, dependencies, core logic, and specific lessons:

  • assets/ - Contains 3D models and textures (e.g., models like the backpack, planets, and skyboxes).
  • external/ - Third-party libraries and dependencies (e.g., GLAD, GLFW, GLM, Assimp).
  • images/ - Output screenshots and animated GIFs used for this documentation.
  • include/ - Common header files representing the core OpenGL wrappers (camera.h, mesh.h, model.h, shader.h).
  • src/ - Contains all execution code and scripts:
    • core/ - Implementing code for core components (camera.cpp, mesh.cpp, shader.cpp, stb_image.cpp).
    • lessons/ - Directory containing the individual .cpp files with main entrypoints for each tutorial/concept covered.
    • shaders/ - GLSL shader files (.vs, .fs, .gs) loaded and utilized by the diverse lessons.

Renders

Advaned Lighting

Point Shadowing

(04-26-2026) Point Shadowing

Shadow Rendering

(04-22-2026) Shadow Rendering with artifacts

Gamma Correction

(04-19-2026) Gamma Corrections

Advanced OpenGL

Asteroids

(04-12-2026) Asteroids

Instancing Ex 1

(04-11-2026) Instancing Example 1

Exploding Normals

(04-10-2026) Normal Explosions

Uniform Buffer Objects

(04-08-2026) Uniform Buffer Objects

Environmental Rendering

Air to Glass Refraction

(04-04-2026) Enviornmental Refraction

Reflections Only

(04-03-2026) Environmental Reflections

Skybox

(03-31-2026) Skybox

Edge Detection

(03-28-2026) Edge Detection

Blurry Rendering

(03-28-2026) Blurry Rendering

Grayscale

(03-28-2026) Grayscale

Inversion

(03-28-2026) Inversion

Semi Transparent Renders (Back to front rendering order)

(03-20-2026) Rendering a semi transparent window

Rendering Transparent

(03-18-2026) Discarding Transparent Fragments

Object Outlining

(03-18-2026) Object Outlining

Lighting

Multiple Lights

(03-08-2026) Multiple Lights

Flashlight

(03-07-2026) Phong Flash light effect

Interesting Game Effect (Flashlight with hardedges)

(03-07-2026) Phong Flash light with hard edges

Point Light

(03-05-2026) Phong Point light model

Phong Lighting Maps Material Model

(03-04-2026) Phong Lighting Maps Material Model

Phong Material Based Model

(03-03-2026) Phong Material Based Model Setup

Phong Model Basic Setup

(02-27-2026) Phong Model Basic Setup

Basic Light Source and Color Render

(02-25-2026) Basic Light Source and colored object

Camera

Free 3D Space Navigation with Doge Cubes

(02-22-2026) Free 3D Space Navigation

Basic camera revolutions

(02-19-2026) 3d Camera Revolution

Coordinate System

Basic Perspective Transform 3D Multiple

(02-18-2026) Perspective Transformation

Basic Perspective Transform 3D

(02-18-2026) Perspective Transformation

Basic Perspective Transform

(02-18-2026) Perspective Transformation

Transformations

(02-17-2026) Animated Transformation

Texture Rendering

(02-16-2026) Texture Mapping

VBO and EBO Visualization

(02-09-2026) Vertex and Element Buffers

First Render

(02-01-2026) First Triangle Render

Prerequisites

Required Dependencies

  • C++ Compiler: MSVC 2019 or later (Visual Studio)
  • OpenGL: Version 3.3 or higher
  • GLFW: Window creation and input handling
  • GLAD: OpenGL function loader
  • GLM: OpenGL Mathematics library (for transformations)
  • stb_image: Image loading library (included in project)

Operating System

  • Windows (Visual Studio project)
  • Can be adapted for Linux/macOS with CMake

Building the Project

Using Visual Studio

  1. Clone the repository:

    git clone https://github.com/yourusername/learnOpenGL.git
    cd learnOpenGL
  2. Open the solution:

    • Open learnOpenGL.slnx in Visual Studio 2022 or later
  3. Configure the project:

    • Ensure GLFW and GLM are properly linked
    • Set include directories for GLAD, GLFW, GLM, and stb_image
    • Set library directories for GLFW
  4. Build:

    • Select your build configuration (Debug/Release)
    • Build the solution (Ctrl+Shift+B)
  5. Run:

    • Set the desired .cpp file as the startup file
    • Run the project (F5 or Ctrl+F5)

Dependencies Setup

Make sure to link the following libraries in your project settings:

  • opengl32.lib
  • glfw3.lib (or glfw3dll.lib if using DLL)

Include directories should point to:

  • GLAD include folder containing glad/glad.h
  • GLFW include folder containing GLFW/glfw3.h
  • GLM include folder containing glm/glm.hpp

Learning Resources

This project follows the excellent tutorials from:

License

This project is licensed under the MIT License - see the LICENSE file for details.

Copyright (c) 2026 Bill Wang

Acknowledgments

  • Joey de Vries for the amazing LearnOpenGL tutorials
  • The OpenGL community for extensive documentation and support
  • GLFW, GLAD, GLM, and stb_image library authors

About

Dedicated repo for learning OpenGL!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors