OpenGL Legacy API
← OpenGL Coordinate Systems | ● | Transformationen →
Houston, we have a problem!
A short history of OpenGL
- OpenGL and the fixed function pipeline (legacy pipeline) exist since ca. 1980
- OpenGL and the programmable pipeline exist since ca. 2000
- OpenGL ES for Embedded Systems exists since 2003
- OpenGL GLSL shader language exists since ca. 2004
- Since 2008 with the introduction of OpenGL 3.0 the fixed function pipeline has ceased to exist any longer.
- It was replaced with a fully programmable pipeline, which is available in the so called core profile. The legacy OpenGL fixed function pipeline is still available in the so called compatibility profile. But the latter is no longer actively developed, so that a core profile needs to be used for newer OpenGL standards and functionality.
- What is more, OpenGL drivers may not support a compatibility profile at all.
- For embedded devices like Android OpenGL ES does not offer a compatibily profile.
As a result, With OpenGL 3.0 functions like glVertex do not exist any longer in the core profile. Those commands are called legacy functions. As a replacement for the legacy functions, later OpenGL versions offer the more efficient vertex buffer objects (VBOs) and programmable GLSL shaders.
With the compatibility profile the legacy functions are still available. But we do not get a higher OpenGL version than 3.2. If we would like to use the latest OpenGL standard (actual OpenGL version is 4.6), we have to use VBOs (vertex array objects) and GLSL shaders (i.e. the programmable pipeline). This is way more efficient than the fixed function pipeline, but it complicates matters for beginners.
For this reason, we use the glVertex C++ wrapper library, which reinstates the legacy functions by emulating them in the core profile, 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:
http://sourceforge.net/projects/glvertex/
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):
Usage example:
lglMatrixMode(LGL_MODELVIEW);
lglLoadIdentity();
lglLooktAt(0,1,0, 0,0,0, 0,1,0);
lglTranslate(0,0.5f,0);
lglColor(1,0,0);
lglBegin(LGL_TRIANGLES);
lglVertex(0,0,0);
lglVertex(-1,-1,0);
lglVertex(1,-1,0);
lglEnd();
More details about the glVertex wrapper library are found in the documentation:
http://sourceforge.net/p/glvertex/wiki/Documentation