opengl-practice is a collection of applications and a graphics library
which I made to practice at OpenGL (4.6 core) and rendering techniques.
Click to see the description
In src/
directory there are 6 subprojects: 5 applications and a library.
Each application inherits all the content from the previous one.
They are made as a demonstation of some techniques and abilities of the library.
The library itself can handle next targets:
- Window creation and initialization of OpenGL context.
- Shader utilities which includes compile functions and also shader watcher - a thread-based function that looks after shader files and recompiles them after changes were detected.
- SceneObject class with the component-based structure. It also includes Component class, which is inherited by BaseCamera (and then OrthographicCamera and PerspectiveCamera), BaseLight (and then DirectionalLight, PointLight and SpotLight) and Mesh (and then Material (and then Texture)). There are also 3 camera controller classes for 3, 4 and 6 degrees of freedom; and also procedural mesh generation algorithms with the level of detail specified.
- Filesystem utilities and different texture loading functions.
- Function for debugging OpenGL.
Click to see used techniques
- 1-triangle:
- Vertex and fragment shaders
- Texture mapping: UV and triplanar
- Texture filtering: bilinear and trilinear
- 2-camera
- Camera and controls
- 3-basic_lighting
- Blinn-Phong lighting model
- Materials
- Multiple direct light sources: directional, point and spot
- 4-advanced_opengl
- Depth testing
- Stencil testing (made objects outline)
- Blending
- Face culling
- Bump mapping: normal and parallax
- Environment mapping
- Framebuffers and postprocessing
- Cubemaps
- Geometry shaders (made objects normals visible)
- Instancing
- Anti-aliasing (MSAA)
- Tessellation shaders (made dynamic level of detail and silhouette smoothing)
- Compute shaders (made procedurally generated textures)
- 5-advanced_lighting
- Gamma correction
- Shadow mapping
- HDR and tone mapping: Reinhard and exposure
TODO:
- Physically Based Rendering
- Cook-Torrance Reflectance Model
- Image Based Lighting
- Subsurface scattering
- Text and fonts
- Model loading
- Make Mesh have children
- Make SceneObject static functions also affect childen of Mesh
- Load models using Assimp library
- Deffered rendering
- Effects
- Fog
- Halo, shaft, backscattering
- Optical distortions
- Bloom
- SSAO
- Motion blur
- Depth of field
Click to see how to build it
The whole project is written in C++ using:
- OpenGL 4.6 (GLFW and GLAD)
- Qt 5
- GLM
- stb_image
Therefore, before building, you need to satisfy all the dependencies by taking these steps:
- Install Qt using your system package manager or official installer.
- Download GLFW, build it,
then place the static library file in
lib/
and header directories ininclude/
. - Download GLAD,
build it as static or shared library and place it in
lib/
then place the header directory ininclude/
. - Download GLM
and place it in
include/
. - Download stb_image
and place it in
include/stb/
.
To build the application run these commands from the project's root:
cmake . -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
You will have your executables built in build/bin/Release/
directory
and libraries in build/lib/Release/
.
opengl-practice is released into public domain.