Multiple rendering contexts and function pointers

Those function pointers the user of OpenGL has to query with wglGetProcAddress - are those addresses static? I mean, every time the app launches and initializes OpenGL function pointers - does it always get the same addresses? Will the separate instance of the program get the same addresses? Or if the app uses multiple rendering contexts (created with the use of wglCreateContext), is it necessary to duplicate and individually initialize the pointers for each of the RC, or the same function’ entry point for all RC will work?

The documentation for wglGetProcAddress says:

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.

But also:

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

These two don’t necessarily contradict. The first warns that they are not necessarily the same (assuming that “not available” == “not the same”), the second gives the condition in which they differ.

So, as long as you’re not creating contexts with different pixel formats, it looks like you can rely on them being the same.

Thanks, mhagain!
I hoped for that to be so! :slight_smile:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.