Table of Contents
To set up the project, follow the steps below.
git clone https://github.com/CGS-IITKGP/OpenGL-template.git --recurse-submodulesUpdate submodule using
git submodule update --init --recursiveThe following dependencies are required to be installed for the project to function properly:
- CMake
-
Linux (Ubuntu/Debian-based)
Install using package managers or from their CMake GitHub page.
sudo apt update sudo apt install cmake
-
macOS
Install using Homebrew or from their CMake GitHub page.
brew install cmake
-
Windows
Install using the installer or from their CMake GitHub page.
- Download the installer from the CMake website.
- Follow the installation steps.
Alternatively, you can install it via winget:
winget install cmake
-
The environment has now been set up and configured to properly compile and run the project.
Run cmake to compile and run the project
cmake .The compiled binary is saved in ./build
To clean the build directory, run
rm -rf build/Note: The latest version of OpenGL is 4.6 but we are using 4.1 for the sake of macOS compatibility. Click here to upgrade to the later version
Glint provides a flexible Shader abstraction that supports vertex, fragment, geometry, and compute shaders.
A shader program can be created by passing the required shader paths to the Shader constructor.
Shader shader(
"shaders/shader.vert.glsl",
"shaders/shader.geom.glsl", // optional
"shaders/shader.frag.glsl"
);- Geometry shaders are optional
- If a geometry shader is not provided, the pipeline defaults to vertex → fragment
- Shader hot-reloading works for all graphics stages
Compute shaders are not part of the graphics pipeline. A compute shader is created using the dedicated constructor:
Shader computeShader(
"shaders/particle_update.comp.glsl"
);Compute shaders are executed explicitly using:
computeShader.use();
glDispatchCompute(x, y, z);
glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT);- Geometry shaders are supported in OpenGL 4.1+
- Compute shaders and SSBOs require OpenGL 4.3+
- Users must upgrade the OpenGL version to use compute shaders
(seeUPGRADE.md)
This repo was forked from dhanvithnayak/OpenGL-template
