OpenGL Legacy API

OpenGL Coordinate Systems | | OpenGL Matrix Stack

Houston, we have a problem!

A short history of OpenGL

  • OpenGL and the fixed function pipeline exist since ca. 1980
  • OpenGL and the programmable pipeline exist since ca. 2000
  • OpenGL ES for Embedded Systems exists since 2003
  • OpenGL GLSL exists since ca. 2004
  • Since 2008 with the introduction of OpenGL 3.0 the fixed function pipeline has ceased to exist any longer.

With OpenGL 3.0 functions like glVertex do not exist any longer. Those commands are called legacy functions. As a replacement for the legacy functions, later OpenGL versions offer the more efficient vertex buffer objecs (VBOs) and GLSL shaders.

To make it even more complicated:

This is true for a so called core profile, in the compatibility profile the legacy functions are still available. But we do not get a higher OpenGL version than 3.2 in the compatibilty profile. If we would like to use the latest OpenGL standard 4.x, we have to use VBOs (vertex array objects) and GLSL shader (i.e. the programmable pipeline). For embedded devices OpenGL ES does not even offer a compatibily profile, so we definitly have to use the programmable pipeline on Android, for example. If we would go for that, we would be having quite a hard time to just get a simple OpenGL example running.

For this reason, it is more convenient for OpenGL beginners, to work with the the Legacy OpenGL API in the first place and proceed gradually to shader programming when getting more experienced with the OpenGL fundamentals. In order to do so, we use the glVertex C++ library, which emulates the legacy functions even if the installed OpenGL drivers do no longer support it. It also eases the use of GLSL shaders, so that much of the initial hassles of the programmable OpenGL pipeline can be avoided.

The glVertex C++ library and its respective documentation is hosted on SourceForge:

In principle this simply means that we replace all occurrences of OpenGL legacy functions with the prefix gl (e.g. glVertex3d) with their emulated C++ counterparts with the prefix lgl (e.g. lglVertex):

glVertex3d(…) → lglVertex(…)

Usage example:

lglLooktAt(0,0,0, 0,0,-1, 0,1,0);

More details about the glVertex wrapper library are found in the documentation:

OpenGL Coordinate Systems | | OpenGL Matrix Stack