This topic has not yet been rated - Rate this topic

wglGetProcAddress function

Applies to: desktop apps only

The wglGetProcAddress function returns the address of an OpenGL extension function for use with the current OpenGL rendering context.

Syntax

PROC WINAPI wglGetProcAddress(
  LPCSTR lpszProc
);

Parameters

lpszProc

Points to a null-terminated string that is the name of the extension function. The name of the extension function must be identical to a corresponding function implemented by OpenGL.

Return value

When the function succeeds, the return value is the address of the extension function.

When no current rendering context exists or the function fails, the return value is NULL. To get extended error information, call GetLastError.

Remarks

The OpenGL library supports multiple implementations of its functions. Extension functions supported in one rendering context are not necessarily available in a separate rendering context. Thus, for a given rendering context in an application, use the function addresses returned by the wglGetProcAddress function only.

The spelling and the case of the extension function pointed to by lpszProc must be identical to that of a function supported and implemented by OpenGL. Because extension functions are not exported by OpenGL, you must use wglGetProcAddress to get the addresses of vendor-specific extension functions.

The extension function addresses are unique for each pixel format. All rendering contexts of a given pixel format share the same extension function addresses.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Wingdi.h

Library

Opengl32.lib

DLL

Opengl32.dll

See also

OpenGL on Windows
WGL Functions
glGetString
wglMakeCurrent

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
No they don't.
"All rendering contexts of a given pixel format share the same extension function addresses."  I don't think this is accurate.  Say I have an ATI graphics board and an nVidia graphics board in my system, with one display attached to each.  I can create a window on each display, choose the same pixel format for each window, create a render context for each, make them current in their respective threads, and retrieve the extension function addresses for each of them using wglGetProcAddress.  Even though the rendering contexts have the same pixel format, the extension functions are in different ICDs, so they will not share the same addresses, right?  One should have pointers into nvoglint.dll, and the other should have pointers into atioglxx.dll.