这是我入门教程, learning Opengl.读了前三节课,感受不错。前三节课细致入微 的讲了如何配置opengl开发环境和历史渊源。 不过在第一大节的第三节课Hello-Window中碰到了一个问题。问题代码以下:this
glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
其中在个人电脑上WindowHint的profile属性值需设置为GLFW_OPENGL_ANY_PROFILE,不然glfwCreateWindow返回NULL。code
官方的说法:GLFW_OPENGL_PROFILE specifies which OpenGL profile to create the context for. Possible values are one of GLFW_OPENGL_CORE_PROFILE or GLFW_OPENGL_COMPAT_PROFILE, or GLFW_OPENGL_ANY_PROFILE to not request a specific profile. If requesting an OpenGL version below 3.2, GLFW_OPENGL_ANY_PROFILE must be used. If OpenGL ES is requested, this hint is ignored. 但我查了下我电脑上opengl版本是3.3,按理说能够用GLFW_OPENGL_CORE_PROFILE这个属性。教程
可能须要查看这边文档opengl registryci
谷歌一下仍是没看到什么结果,有空再找吧。开发