
Many of these functions are similar to those in the math library of the C programming language while others are specific to graphics programming. The graphics card manufacturer may optimize built-in functions at the hardware level. User-defined functions are supported and built-in functions are provided. Recursion is forbidden and checked for during compilation.

Similar to the C programming language, GLSL supports loops and branching, for instance: if-else, for, switch, etc. Bitwise operators were added in version 1.30.įunctions and control structures GLSL contains the same operators as the operators in C and C++, with the exception of pointers. They can be interconverted through SPIRV-Cross. The two languages are related but not directly compatible. OpenGL ES and WebGL use OpenGL ES Shading Language (abbreviated: GLSL ES or ESSL). These versions for GLSL and OpenGL are related in the following table: It is only with OpenGL versions 3.3 and above that the GLSL and OpenGL major and minor version numbers match. GLSL versions have evolved alongside specific versions of the OpenGL API.

Originally introduced as an extension to OpenGL 1.4, GLSL was formally included into the OpenGL 2.0 core in 2004 by the OpenGL ARB. The OpenGL ARB created the OpenGL Shading Language to provide a more intuitive method for programming the graphics processing unit while maintaining the open standards advantage that has driven OpenGL throughout its history. Originally, this functionality was achieved by writing shaders in ARB assembly language – a complex and unintuitive task. Programmability at this level is achieved with the use of fragment and vertex shaders. With advances in graphics cards, new features have been added to allow for increased flexibility in the rendering pipeline at the vertex and fragment level.

It was created by the OpenGL ARB (OpenGL Architecture Review Board) to give developers more direct control of the graphics pipeline without having to use ARB assembly language or hardware-specific languages. OpenGL Shading Language ( GLSL) is a high-level shading language with a syntax based on the C programming language. The compiled programs are executed on the GPU. Shaders are written in OpenGL Shading Language and compiled. Video games outsource rendering calculations to the GPU over OpenGL in real-time. Not to be confused with Open Shading Language.
