Legacy OpenGL

From OpenGL.org
Revision as of 12:38, 30 August 2012 by Kopelrativ (Talk | contribs) (Compatibility: Added section about embedded OpenGL.)

Jump to: navigation, search

In 2008, OpenGL version 3.0 was released. With this change, immediate mode with the Fixed Function Pipeline was no longer supported. The functionality has been deprecated, and is sometimes referenced as Legacy OpenGL. It is still supported, and you can probably count on it being available. But there are some serious disadvantages that should be considered. Learning immediate mode as a beginner has a limited value, as most real applications are based on at least OpenGL3.

How do I know what is what?

A typical sign of the immediate mode is the use of glBegin() and glEnd(). Immediate mode is based on a procedural method, where vertex data is defined by using glVertex, glColor,glNormal, etc.

What are the advantages of OpenGL3?

Much of this was available before OpenGL3, but not for immediate mode.


  • Vertex data can transfered once to the GPU, and rendered many times. That can improve FPS when the amount of data is big.

Flexibility using shaders

  • Sooner or later, real 3D projects come to a point where something more complicated needs to be done. At that point, the flexibility with the free data format of VBOs and the possibility to compute the results using flexible shader programs, will enable efficient design.


  • OpenGL ES 2 doesn't support immediate mode. If the application is supposed to portable or compatible with mobile devices, the legacy options is not available.

What are the basic changes?

At first, it may look like a lot of effort to do something that was simple in immediate mode. And it is more effort, but as soon as you have got it working it is easy to expand. An application based on the immediate mode can require significant effort to adapt.

  • You have to create the shader program yourself. Minimum is a vertex shader and one fragment shader.
  • The vertex data is defined in one or more VBO:s (Vertex Buffer Object).
  • You have to create at least one VAO (Vertex Array Object to store the states of your geometry.
  • You can no longer use glMatrixMode or the other pre defined matrix functions. Instead, you manage the matrices yourself, and deliver them to the shader program using uniforms. There are good external libraries for this.
  • Your polygons can never have more than 3 vertices. That is, a triangle. Though GL_TRIANGLE_STRIP and similar are still supported.