How to Shaders

Intro to the engine's shading API - GLSLProgram

Manage shaders via the GLSLProgram

GLSLProgram.hpp - class declarations
GLSLProgram.cpp - class implementation

Example shader implementations

shader.vert
#version 450 core                                         
                                
uniform mat4 model_view;
uniform mat4 projection;
								
layout(location = 0) in vec4 position;

layout(location = 0) out vec4 vertex_pos;
                                    
void main(void)
{
    gl_Position = projection * model_view * position;
    vertex_pos = position;
}

Require the shader class in your application

Instantiate a shader program object

Compile & Build the shader program from your sources

Vertex & Fragment shaders are both enough and mandatory to start with.

Example

Compile shader from file

Build the comiled shader

Use the shader or change the shader that is currently in use

Bind current shader

Unbind current shader

Last updated