Extensions to the Standard (OpenGL Programming)

OpenGL has a formal written specification that describes the operations that comprise the library. An individual vendor or a group of vendors may decide to add additional functionality to their released implementation.

Function and symbolic constant names clearly indicate whether a feature is part of the OpenGL standard, a vendor-specific extension, or an OpenGL extension approved by the OpenGL ARB (Architecture Review Board).

To make a vendor-specific name, the vendor appends a company identifier (in uppercase) and, if needed, additional information, such as a machine name. For example, if XYZ Corporation wants to add a new function and symbolic constant, they might be of the form glCommandXYZ() and GL_DEFINITION_XYZ. If XYZ Corporation wants to have an extension that is available only on its FooBar graphics board, the names might be glCommandXYZfb() and GL_DEFINITION_XYZ_FB.

If two or more vendors agree to implement the same extension, then the functions and constants are suffixed with the more generic EXT (glCommandEXT() and GLJDEFINITION_EXT).

Similarly, if the OpenGL ARB approves an extension, the functions and constants are suffixed with ARB (glCommandARB() and GL_DEFINITION_ARB).

If you want to know if a specific extension is supported on your implementation, first use glGetString(GL_EXTENSIONS), and then use gluGetString(GLU_EXTENSIONS). This returns a list of all the extensions in the implementation, separated by spaces.


OpenGL 1.2 introduces the first ARB-approved extensions. If the optional Imaging Subset is supported, then GL_ARB_imaging will be present in the returned extension string. The string GL_ARB_multitexture indicates the presence of the ARB-approved multitexture extension.

If you have GLU 1.3, you can use gluCheckExtension() to see if a specified extension is supported.

GLboolean gluCheckExtension(char *extName, const GLubyte *cxtString);

Returns GL..TRUE if extNamc is found in extString, or GL_FALSE if it isn’t.

gluCheckExtension() can check OpenGL and GLX extension strings, as well as GLU extension strings.

Prior to GLU 1.3, to find out if a specific extension is supported, use the code in Example 14-2 to search through the list and match the extension name. QueryExtension() returns GL_TRUE if the string is found, or GL_FALSE if it isn’t.

Example 14-2 Determining if an Extension Is Supported (Prior to GLU 1.3)

tmp73ec-51_thumbDetermining if an Extension Is Supported (Prior to GLU 1.3)

Extensions to the Standard for Microsoft Windows (WGL)

If you need access to an extension function on a Microsoft Windows platform, you should

•  create conditional code based on the symbolic constant, which identifies the extension

• query the previously discussed extension string at run-time

• use wglGetProcAddressO to locate the pointer to the extension function

Example 14-3 demonstrates how to find a fictitious extension named glSpecialEXT(). Note that the conditional code (tifdef) verifies the definition of GL_EXT_special. If the extension is available, a data type (in this case, PFNGLSPECIALEXTPROC) is specifically defined for the function pointer. Finally, wglGetProcAddress() obtains the function pointer.

Example 14-3 Locating an OpenGL Extension with wglGetProcAddressQ

Locating an OpenGL Extension with wglGetProcAddressQ

Next post:

Previous post: