next up previous contents
Next: 19.1.3 Source Compatibility Across Up: 19.1 General Concerns Previous: 19.1.1 Handle Runtime Feature   Contents

19.1.2 Extensions and OpenGL Versioning

Some current OpenGL features were introduced first as extensions and eventually incorporated into the OpenGL core in a later version. For example, the glPolygonOffset() command is both an extension and a part of OpenGL 1.1. Usually when an extension is incorporated into an OpenGL version, the extension suffixes from the commands and enumerants are removed and functionality is unchanged from the extension specification. In rare cases, the behavior diverges from the original extension when implementation experience suggests useful improvements. For example, the EXT_polygon_offset, EXT_vertex_array and EXT_blend_logicop extensions changed a little when they were added to OpenGL 1.1, whereas the EXT_texture3D, EXT_texture_lod, extensions remained essentially the same when their functionality was incorporated into OpenGL 1.2.

Some implementations of new versions of OpenGL may continue to support both the extension as well as the new version of the functionality. For cases where the core functionality behavior has diverged from the extension specification, the implemented extension behavior should still be compatible with the original extension specification.

While it is best to try to write applications to the latest version of OpenGL, sometimes it is desirable to support new and older versions of OpenGL as well as extensions within the same application in order to maximize the number of platforms the application will run on. To achieve this, the application must provide both compile-time and run-time guards to test for the existence of needed functionality for both the OpenGL version numbers and extension availability. At compile-time the OpenGL version can be tested with #ifdef GL_VERSION_1_1 and #ifdef GL_VERSION_1_2 and the run-time version can be tested with glGetStringGL_ VERSION(GL_ VERSION). The first few characters of the version string will contain the current version number: 1.0, 1.1, or 1.2.


next up previous contents
Next: 19.1.3 Source Compatibility Across Up: 19.1 General Concerns Previous: 19.1.1 Handle Runtime Feature   Contents
2001-01-10