Microsoft KB Archive/328303

= How to use the Windows OpenGL extension mechanism to access OpenGL extensions =

Article ID: 328303

Article Last Modified on 2/12/2007

-

APPLIES TO


 * Microsoft Platform Software Development Kit-January 2000 Edition
 * Microsoft Windows XP Professional
 * Microsoft Windows XP Professional for Itanium-based systems

-



This article was previously published under Q328303



SUMMARY
With the OpenGL extension mechanism, OpenGL applications can access non-standard OpenGL functions that may be implemented by the OpenGL vendor or by the video driver vendor.

These functions can be new OpenGL functions that are not implemented in the standard OpenGL library, or, they can be functions that extend the capabilities of existing OpenGL functions.

The source of the extension is indicated by the suffix of the extension function (or by the suffix of the extension constant). For example, the suffix WIN indicates a Windows-specific extension, and the suffixes EXT or ARB indicate extensions that are defined by multiple vendors.

This article describes how to access extension functions.



MORE INFORMATION
To access an extension function that is not part of the standard OpenGL library, call the wglGetProcAddress function. If the extension function exists in the current implementation, then wglGetProcAddress gives you a function pointer, which you can use to access the function. Otherwise, wglGetProcAddress returns NULL.

For example, to access the glAddSwapHintRectWIN extension function, call wglGetProcAddress as follows: // Get a pointer to the extension function. typedef void (WINAPI *FNSWAPHINT)(GLint, GLint, GLsizei, GLsizei); fnSwapHint = (FNSWAPHINT)wglGetProcAddress(&quot;glAddSwapHintRectWIN&quot;);

// Actual call to glAddSwapHintRectWIN. if (fnSwapHint != NULL) (*fnSwapHint)(0, 0, 100, 100);

