How to get the GLFW_CONTEXT_VERSION_MAJOR value? This code snippet:

GLint versionMajor;
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
glGetIntegerv(GLFW_CONTEXT_VERSION_MAJOR, &amp;versionMajor);
std::cout &lt;&lt; "Version major:" &lt;&lt; version &lt;&lt; std::endl;


prints "3" in my screen, but in the first line I set the the GLFW_CONTEXT_VERSION_MAJOR to "2". How I can get back that value?
According to the GLFW docs, the context version hint acts as a minimum version, i.e. the context you actually get may be a higher version than what you request. However, the context should be backward-compatible, so even if you get a GL 3.x context you're OK to use GL 2.x code.