Are OpenGL functions loaded in context or thread? (Windows)

Consider a scenario in which two render contexts (each of which belongs to their own window) exist on two separate threads of execution. Do I need to load OpenGL function pointers and use them separately for each one? Or can gl * function pointers be global, loaded only once for a given application instance, and used by both windows or contexts?

The reason I am asking is because OpenGL Function Loading Docs , when talking about loading wgl functions, indicates:

This feature only works when a valid OpenGL context is present. Indeed, the function pointers it returns are themselves context sensitive . The Windows documentation for this function states that the returned functions can work with a different context, depending on the provider of that context and the format of the context pixel.

In practice, if two contexts come from the same vendor and refer to the same GPU, then function pointers inferred from one context will work in the other. This is important when creating an OpenGL context on Windows, as you need to create a "dummy" context to get the WGL extension functionality to create a real one.

my attention.

I was wondering if there is such a requirement for OpenGL features?

+3


source to share


2 answers


You missed one sentence before the paragraph you copied in your question (emphasis mine):

[...] The functions can be OpenGL functions or platform specific WGL functions .

This feature only works when a valid OpenGL context is present. Indeed, the function pointers it returns are themselves context sensitive [...]



This means that the loaded OpenGL functions are context sensitive, for example WGL functions are on Windows.

+3


source


Older hardware may return different function pointers for different contexts. I am currently in doubt. GLEW is moving to avoid this multi-context (MX) feature.



0


source







All Articles