Skip to content

A number of samples of rendering and optimization techniques with modern OpenGL

Notifications You must be signed in to change notification settings

shybovycha/opengl-samples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advanced modern OpenGL rendering technique & optimization samples

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.

Building

$ cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake
$ cmake --build build

Samples

Basics

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

Rendering techniques

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

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

Optimization techniques

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

About

A number of samples of rendering and optimization techniques with modern OpenGL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published