3
$\begingroup$

This code snippet:

GLint versionMajor;
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
glGetIntegerv(GLFW_CONTEXT_VERSION_MAJOR, &versionMajor);
std::cout << "Version major:" << version << 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?

$\endgroup$
1
  • 1
    $\begingroup$ glGetIntegerv(GLFW_CONTEXT_VERSION_MAJOR I'm pretty sure that doesn't work. OpenGL doesn't know what to do with GLFW_CONTEXT_VERSION_MAJOR. $\endgroup$ Commented Jan 21, 2017 at 18:43

1 Answer 1

4
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.