Context Basics
Basics you need to know about GLFW contexts
Context Objects
When working with OpenGL or OpenGL ES, a GLFW window object encapsulates an OpenGL or OpenGL ES context. This context object is created when a window is created and is destroyed when a window is destroyed or GLFW is terminated. More information about working with OpenGL and OpenGL ES context can be found here.
Vulkan does not require such a context object. More information about working with Vulkan can be found here.
Creation Hints
There are a couple of context-related window creation hints that affect context objects, for example the version or profile of OpenGL to use.
Context Sharing
An OpenGL (ES) context object can be shared between windows. This is useful when working with multithreading, as it makes the resources created in one context available to the context on a different thread. When creating a window, instead of using NULL
, the last parameter share
of glfwCreateWindow
should be a pointer to the window, which's context you want the new window's context to be shared with.
This means, to employ multithreading, a second window has to be created. This window can be made invisible by using the GLFW_VISIBLE
creation hint.
Last updated