Skip to content

CGS-IITKGP/OpenGL-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


image

Glint

Boilerplate for OpenGL applications

Table of Contents

Getting Started

To set up the project, follow the steps below.

Clone the repository

git clone https://github.com/CGS-IITKGP/OpenGL-template.git --recurse-submodules

Update submodule using

git submodule update --init --recursive

Prerequisites

The 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.

      1. Download the installer from the CMake website.
      2. Follow the installation steps. Alternatively, you can install it via winget: winget install cmake

(back to top)

Installation

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

(back to top)

Additional documentation

Shader system (Geometry & Compute shaders)

Glint provides a flexible Shader abstraction that supports vertex, fragment, geometry, and compute shaders.

Creating a graphics shader (vertex / fragment / geometry)

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

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);

Notes on OpenGL version support

  • 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
    (see UPGRADE.md)

Ask DeepWiki

This repo was forked from dhanvithnayak/OpenGL-template

(back to top)

About

Boilerplate for any OpenGL project

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •