Reputation: 41
I've begun using OpenGL via C++ and GLFW, but calls to glfwCreateWindow(...)
aren't creating a context using the latest version of OpenGL available on my system (currently 4.3).
I've used OpenGL 4.3 contexts before with Java and LWJGL, but since switching to GLFW I've been unsuccessful.
Adding calls to
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
causes glfwCreateWindow(...)
to return an error code, though changing the minor version to 2 works fine. Adding window hints to use a core profile and setting forward-compatibility to true also have no effect.
Does anyone know what the cause of it might be/a solution to this problem?
Edit: This is on Windows 7.
Upvotes: 3
Views: 4872
Reputation: 5674
Do this:
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); // yes, 3 and 2!!!
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
And you can use OpenGL 4.x anyways...
Why?
Check the FAQ -- "4.1 - How do I create an OpenGL 3.0+ context?"
Upvotes: 3