Drawing3d documented Class Library

FeaturesW32.wglGetProcAddress Method

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

[Visual Basic]
<PreserveSig> _
<DllImport(EntryPoint:="wglGetProcAddress", CharSet:=CharSet.None, SetLastError:=False, ExactSpelling:=True, PreserveSig:=True, CallingConvention:=CallingConvention.Winapi, BestFitMapping:=False, ThrowOnUnmappableChar:=False, Value:="opengl32.dll")> _
Public Shared Sub wglGetProcAddress( _
   ByVal extension As String _
[DllImport(EntryPoint="wglGetProcAddress", CharSet=CharSet.None, SetLastError=False, ExactSpelling=True, PreserveSig=True, CallingConvention=CallingConvention.Winapi, BestFitMapping=False, ThrowOnUnmappableChar=False, Value="opengl32.dll")]
public static IntPtr wglGetProcAddress(
   string extension



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 Zero. To get extended error information, call GetLastWin32Error.


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 extension 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.

See Also

FeaturesW32 Class | Drawing3d.OS.Windows Namespace | wglMakeCurrent