How to use the Windows OpenGL extension mechanism to access OpenGL extensions (328303)



The information in this article applies to:

  • Microsoft Platform Software Development Kit (SDK) 1.0
  • Microsoft Windows XP Professional
  • the operating system: Microsoft Windows XP 64-Bit Edition

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("glAddSwapHintRectWIN");

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

REFERENCES

For more information about OpenGL, see the Help documentation for the Platform SDK.

Modification Type:MinorLast Reviewed:5/17/2006
Keywords:kbDSWGDI2003Swept kbhowto kbOpenGL KB328303