This repo contains a number of samples of some advanced rendering techniques with modern OpenGL. Modern as in 4.4 .. 4.6. There are also few samples showing the rendering optimization techniques.
The samples use few 3rd party libraries for simplifying the code and reducing the boilerplate:
- SFML - create window, handle user input events (mouse & keyboard), load images from files (for textures)
- assimp - loading 3D models from files in various formats
- GLM - math (matrices, vectors, projections)
- globjects - OpenGL abstraction interfaces (so no more direct calls to
gl*
) - Dear ImGUI - GUI library (windows, buttons, text input controls, sliders, etc.)
The code is built with CMake and vcpkg (for dependency management). I tried sticking to modern C++ guidelines and using C++20 features whenever feasible.
Samples have been built and tested under Windows and OSX.
$ cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake
$ cmake --build build
create an SFML window
initialize OpenGL context with globjects
implement a simple user-controlled first-person camera with GLM
render 3D shape with OpenGL
load texture from file and render a textured 3D model
simple lighting techniques (Blinn-Phong), basically a simple shader test
load a 3D model from file and render it with OpenGL
render to framebuffer and then to the screen
simple shadow mapping
rendering particles; simple particle engine (TODO: should use SPARK, like in skylicht engine ?)
rendering a terrain; very simple, not paginated (TODO)
point light source (using cubemaps)
bloom effect
simple anti-aliasing using out-of-the-box OpenGL capabilities
rendering skybox
rendering reflective objects (using cubemaps)
simple GUI with Dear ImGUI
20-scripting (TODO)
deferred rendering, aka render different attributes of each pixel to the framebuffers first and then combine them all into a final frame in one go (potentially applying post-processing effects) and display on the screen in one go
simple SSAO implementation
volumetric light using raymarching
27-animated-model (TODO)
rendering multiple instances of an object using OpenGL capabilities to render many things in one draw call
optimizing shadow mapping for large (think outdoor, landscape) scenes
faster anti-aliasing algorithm
MSAA algorithm
HBAO, nVidia algorithm, optimization for performance and quality over SSAO
optimized "batched" rendering using modern OpenGL capabilities (glMultiDrawIndirect
), reducing the number of draw calls