Search code examples
glfw

GLFW | What is a context?


I am trying to understand what's GLFW_CONTEXT_VERSION_MAJOR and GLFW_CONTEXT_VERSION_MINOR. And what exactly those functions do:

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);

And it seems to me that first of all I must find out what is context. Documentation explanation looks too complicated and doesn't even give its definition, so I can't understand what it is and what's its purpose.


Solution

  • It states in the first sentence with the headline Context objects: "A window object encapsulates both a top-level window and an OpenGL or OpenGL ES context."

    So it will be an OpenGL/OpenGL ES context. The functions set the OpenGL/OpenGL ES version requirement for that context the window will create when you create the window.

    In your example above GLFW will try to create an OpenGL 3.3 context for that window.