Skip to content

McNopper/OpenGL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

287 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenGL

OpenGL 3 and OpenGL 4 with GLSL

Build Instructions

Prerequisites

Required:

  • CMake 3.14 or higher - Download
  • C/C++ Compiler:
    • Windows: Visual Studio 2013+ (MSVC)
    • Linux: GCC or Clang
    • macOS: Xcode Command Line Tools
  • Git - For fetching dependencies
  • OpenGL 3.2+ compatible graphics driver

Verify Installation

Check if CMake is installed:

cmake --version

Should show version 3.14 or higher.

Check if Git is installed:

git --version

Building

Dependencies (GLFW and GLEW) are automatically downloaded and built via CMake FetchContent.

Windows (Visual Studio):

mkdir build && cd build
cmake ..
cmake --build .

Linux / macOS:

mkdir build && cd build
cmake ..
make

Executables will be in the Binaries/ directory.

Dependencies

All dependencies are automatically fetched and built:

  • GLFW 3.4 - Windowing and input
  • GLEW 2.2.0 - OpenGL Extension Wrangler
  • OpenGL 3.2+ - System graphics library

Examples

All 46 examples demonstrate various OpenGL 3.x and 4.x features with GLSL shaders.

Example01 - Basic window and OpenGL 3 initialization

Example01

Example02 - Rendering of a triangle

Example02

Example03 - Grey filter

Example03

Example04 - Perspective rendering of a cube

Example04

Example05 - Phong rendering of a sphere

Example05

Example06 - Texturing of a cube

Example06

Example07 - Normal mapping

Example07

Example08 - Environment/cube mapping

Example08

Example09 - GPU Particles

Example09

Example10 - Geometry shader

Example10

Example11 - Reflection and refraction

Example11

Example12 - Shadow mapping

Example12

Example13 - Simple tessellation (OpenGL 4.1)

Example13

Example14 - Terrain rendering (OpenGL 4.1)

Example14

Example15 - Water rendering

Example15

Example16 - Model loading and rendering

Example16

Example17 - Clipping planes and two sided rendering

Example17

Example18 - Using stencil buffer and clipping planes

Example18

Example19 - Render to texture and planar reflection

Example19

Example20 - Texture matrix, alpha blending and discarding

Example20

Example21 - Compute shader (OpenGL 4.3)

Example21

Example22 - Shadow volumes

Example22

Example23 - Displacement mapping (OpenGL 4.1)

Example23

Example24 - Erode effect using perlin noise

Example24

Example25 - Model with groups and materials

Example25

Example26 - Fur rendering

Example26

Example27 - Projection shadow for directional light

Example27

Example28 - Screen space ambient occlusion (SSAO) (OpenGL 4.1)

Example28

Example29 - CPU ray tracing

Example29

Example30 - GPU ray tracing using compute shader (OpenGL 4.3)

Example30

Example31 - Many lights using deferred shading (OpenGL 4.1)

Example31

Example32 - BRDF and IBL rendering (OpenGL 4.1)

Example32

Example33 - Real-Time BRDF and IBL rendering (OpenGL 4.1)

Example33

Example34 - Subsurface scattering

Example34

Example35 - Order independent transparency using depth peeling

Example35

Example36 - Order independent transparency using linked list (OpenGL 4.4)

Example36

Example37 - CPU ray marching

Example37

Example38 - Basic usage of program pipeline and separable programs (OpenGL 4.1)

Example38

Example39 - Basic usage of program pipeline, separable programs and shader subroutines (OpenGL 4.1)

Example39

Example40 - Cloth simulation using compute shader (OpenGL 4.3)

Example40

Example41 - Ocean wave height/normal map calculation with FFT using compute shader (OpenGL 4.3)

Example41

Example42 - Fast Approximate Anti Aliasing - FXAA (OpenGL 4.3)

Example42

Example43 - Scene with several models having groups and materials

Example43

Example44 - Conservative rasterization

Example44

Example45 - GPU voxelization (OpenGL 4.4)

Example45

Example46 - Voxel cone tracing - Global illumination (OpenGL 4.4)

Real-time global illumination using voxel cone tracing based on Crassin et al. 2011. The Sponza scene is first voxelized into a 64³ RGBA8 3D texture with a dominant-axis geometry shader. Mipmaps are generated for the voxel grid, then the final pass traces six diffuse cones plus a specular cone per fragment to compute indirect illumination, ambient occlusion, and specular reflections.

Simplifications vs. the original paper:

Aspect Paper This implementation
Scene representation Sparse Voxel Octree (SVO) — adaptive, high-resolution Flat 64³ RGBA8 3D texture — simpler, lower resolution
Voxel filtering Anisotropic pre-filtering: per-face directional radiance propagated up the octree Isotropic glGenerateMipmap box filter
Radiance storage Per-face (6 directions) for directional shadowing Single isotropic value per voxel
Voxel write Atomic accumulation when multiple triangles cover the same voxel Plain imageStore (last-write-wins)

Example46

About

OpenGL 3 and 4 examples using GLSL

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors