Harold Serrano

View Original

The evolution of OpenGL and GLSL

To understand how OpenGL Shaders work, it is a good idea to review how OpenGL has evolved and the changes implemented on each GLSL version. The table below provides a timeline for OpenGL.

I'm summarizing the information I read on this amazing book: Graphics Shaders: Theory and Practice

The Evolution of OpenGL and GLSL

OpenGL 2.0/GLSL 1.10

This OpenGL version introduced the GLSL language. It also introduced programmable Vertex and Fragment shaders.

This version includes the following:

  • Vertex buffer objects let you store vertex arrays in graphics memory to reduce the amount of communication needed between the CPU and card.
  • Occlusion queries let you ask how many pixels a particular scene element would occupy if displayed.
  • Texture-mapped point sprites let you create many small 2D objects for uses such as particle systems.
  • Separate stencil operations for front and back faces give you better support for shadowing.[1]

OpenGL 3.x/GLSL 3.30

This version introduced Geometry Shaders. The following capabilities were added:

  • Frame buffer objects let you render into non-displayable buffers for such uses as render-to-texture.
  • Texture buffer objects allow you to use much larger texture arrays.
  • Uniform buffer objects let you define a collection of uniform variables so that you can quickly switch between different sets of uniform variables in a single program object or share the same set of uniform variables between different program objects.
  • For textures, you can now define a Texture Array (sometimes called an array texture) that contains a sequence of 1D or 2D textures of the same size, so you can use different textures without having to do multiple tex-ture bindings.
  • When variables are interpolated in the fragment shader, you can choose different interpolation techniques with the interpolation qualifiers centroid, flat, invariant, or nonperspective.
  • There is now a layout qualifier that can be applied to either in or out variables for some shaders.[1]

The following capabilities were deprecated:

  • Any use of the fixed-function vertex or fragment operations; you now need to use shaders for everything.
  • The use of glBegin/glEnd to define primitives; you now need to use vertex arrays and vertex buffers for your geometry.
  • Use of quad or polygon primitives; you now only use triangles.
  • Use of display lists; you now use vertex arrays and vertex buffers.
  • Use of most of the built-in attribute and uniform variables in GLSL; you now need to define all these in your application and pass them all into your shaders.[1]

OpenGL 4.0/GLSL 4.00

This version introduced Tesselation Shaders. These shaders lets you generate new geometry to provide greater detail in your geometry.

  • You can now have multiple iterations of a single geometry shader to create multiple instances of the shader, letting you recursively subdivide geometry primitives.
  • You can also create multiple vertex streams from a geometry shader, with the first stream being the normal output to primitive assembly and the rasterizer, and with additional streams going to transform feedback objects.
  • With GLSL 4.0, the shader language becomes more C-like. You can get the functionality of the #include statement. [1]

OpenGL ES

The OpenGL ES 2.0 is designed for mobile devices. It does not support any fixed-function operations. It supports Vertex and Fragment shaders, but it does not support Geometry nor Tessellation shaders.

Reference:

  1. Graphics Shaders: Theory and Practice