#version 450 corelayout (vertices =3) out;voidmain(void){// Only if I am invocation 0...if(gl_InvocationID ==0) { gl_TessLevelInner[0] =5.0; gl_TessLevelOuter[0] =5.0; gl_TessLevelOuter[1] =5.0; gl_TessLevelOuter[2] =5.0; }// Everybody copies their input to their output gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;}
Require the shader class in your application
#include"graphics/shaders/GLSLProgram.hpp"
Instantiate a shader program object
// using default ctorGLSLProgram shader;
Compile & Build the shader program from your sources
Vertex & Fragment shaders are both enough and mandatory to start with.
std::string and char* sources are accepted
can be file path or a shader code as a string
Example
Compile shader from file
// load and compile shadersshader.CompileShaderFile("res/shaders/example.vert", GLSLShader::GLSLShaderType::VERTEX);shader.CompileShaderFile("res/shaders/example.frag", GLSLShader::GLSLShaderType::FRAGMENT);
Build the comiled shader
// link the shades into the programshader.Build();
Use the shader or change the shader that is currently in use