GLFW can't create 4.3 context

。_饼干妹妹 提交于 2020-01-03 22:57:11

问题


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.


回答1:


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?"



来源:https://stackoverflow.com/questions/19719404/glfw-cant-create-4-3-context

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!