openglShaders


Syntax

  • #version version_number // Which GLSL version we are using
  • void main() { /* Code */ } // Shader's main function
  • in type name; // Specifies an input parameter - GLSL 1.30
  • out type name; // Specifies an output parameter - GLSL 1.30
  • inout type name; // Parameter for both input and output - GLSL 1.30

Parameters

ParameterDetails
typeThe parameter's type, it has to be a GLSL built-in type.

Remarks

To specify which version of GLSL should be used to compile a shader, use the version preprocessor e.g. #version 330. Each version of OpenGL is required to support specific versions of GLSL. If a #version​ preprocessor is not defined at the top of a shader, the default version 1.10 is used.