OpenGL ES Shading Language

from Wikipedia, the free encyclopedia
OpenGL ES Shading Language
Publishing year: 2009
Developer: Khronos Group
Current  version : 3.20   (August 6, 2015)
Influenced by: OpenGL Shading Language and C
www.khronos.org/opengles/

The OpenGL ES Shading Language (short: GLSL ES ) is a programming language with which the programmable units of a graphics processor , so-called shaders , are created. These shaders are compiled, linked to one another to form a finished program and executed on embedded systems using OpenGL ES .

Language features

GLSL ES is based on the OpenGL Shading Language (GLSL) and as such is also a C -like programming language. In contrast to GLSL, the current version of GLSL ES has fewer texture data types (samplers) and offers significantly fewer built-in variables and functions. In addition, the precision qualifier can be used to determine the minimum range and accuracy of a floating point or integer data type.

example

An example of a simple GLSL-ES program consisting of a vertex and a fragment shader; the program draws objects in a previously defined color:

Vertex shader

This vertex shader positions the vertex ( a_vertex) modelViewProjectionMatrixrelative to the camera in space with the help of the matrix , and transfers the color (a_color) passed by the OpenGL ES API to the fragment shader.

uniform mat4 modelViewProjectionMatrix;
attribute vec4 a_vertex;
attribute vec4 a_color;
varying vec4 v_color;

void main()
{
  v_color = a_color;
  gl_Position = modelViewProjectionMatrix * a_vertex;
}

The same example in version 3.00:

#version 300 es
uniform mat4 modelViewProjectionMatrix;
layout (location = 0) in vec4 a_vertex;
layout (location = 1) in vec4 a_color;
out vec4 v_color;

void main()
{
  v_color = a_color;
  gl_Position = modelViewProjectionMatrix * a_vertex;
}

Fragment shader

This fragment shader sets the drawing color of the fragment to the color passed by the vertex shader.

precision mediump float;
varying vec4 v_color;

void main()
{
  gl_FragColor = v_color;
}

Same example in version 3.00

#version 300 es
precision mediump float;
in vec4 v_color;
out vec4 my_fragcolor;

void main()
{
  my_fragcolor = v_color;
}

history

Legend: Old version Older version; still supported Current version Current preliminary version Future version
version publication Description / changes
Older version; no longer supported: 1.00 May 12, 2009
  • OpenGL ES 2.0
  • first publication
Older version; no longer supported: 3.00 July 11, 2012
  • OpenGL ES 3.0
  • Multiple choice
  • Non-square matrices
  • Centroid-based interpolation and non-interpolation between vertex and fragment shaders
  • Matrix functions
  • Derivative functions
  • Integer texture data types
  • Unsigned integer, vector, and texture data types
  • hyperbolic angle functions
  • separating and rounding floating point numbers
  • Format layout for variable declaration
  • Conversion between integers and floating point numbers with retention of the bit-level representation
  • Packing and unpacking numbers
Older version; no longer supported: 3.10 17th March 2014
  • OpenGL ES 3.1
  • Compute shader
  • Shader memory buffer objects
  • Arrays of arrays
  • Atomic counter
  • Images
  • Separate program objects (also known as separate shader objects)
  • Explicit uniform locations
  • Texture gather
  • Bitfield operations
  • Integer mix functions
Current version: 3.20 August 6, 2015
  • OpenGL ES 3.2
  • Geometry shader
  • Tessellation control shader
  • Tessellation evaluation shader

Web links