The mglsdr Format
When using the mglsdr format, each shader needs to have a header from the list below:
%vertex_shader
%fragment_shader
Each header starts with a % sign. This indicates the start of a shader type and can be thought of as two separate files. This means that as with standard shaders, variables created in one shader are not automatically available in another shader and need to be passed through using 'out' and 'in'. The shader version also needs to be declared in both shaders.
Example Shader
%vertex_shader
#version 450 core
layout (location = 0) in vec4 position;
out vec4 pos;
uniform mat4 trMatrix;
void main() {
gl_Position = position * trMatrix;
pos = position;
}
%fragment_shader
#version 450 core
layout (location = 0) out vec4 color;
in vec4 pos;
void main() {
color = pos;
}