GLFW:已请求配置文件,但 WGL_ARB_create_context_profile 不可用

GLFW: profile requested but WGL_ARB_create_context_profile is unavailable

我无法打开 OpenGL window,由于以下错误消息(我在 Windows):

GLFW Error Code 65543: WGL: OpenGL profile requested but WGL_ARB_create_context_profile is unavailable.

我的问题很可能是驱动问题。我尝试更新它们(使用 Intel Driver Update Utility),但没有成功(而且我的驱动程序似乎已经是最新的)。我使用内置的 Intel HD Graphics 3000。我还安装了一个 OpenGL 查看器,它告诉我我的 OpenGL 版本是 3.1)。

此外,我尝试了 this solution

整个 C++ 代码非常庞大,所以我不会全部复制,但这里是有趣的部分:

if( !glfwInit() )
{
  std::cerr<<"Failed to initialize GLFW\n"<<std::endl;
  return -1;
}
glfwSetErrorCallback(glfwErrorCallback);

// Create the OpenGL window
glfwWindowHint(GLFW_DEPTH_BITS, 16);
glfwWindowHint(GLFW_SAMPLES, 4);

//Those stop GLFW from initializing successfully?
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

// Open OpenGL fullscreen window
gGLFWWindow = glfwCreateWindow(gWidth,gHeight,"GLFW OpenGL Window",nullptr,nullptr);

if(!gGLFWWindow)
{
  std::cerr<<"Failed to open GLFW window\n"<<std::endl;
  glfwTerminate();
  return -1;
}

// Disable VSync (we want to get as high FPS as possible!)
glfwMakeContextCurrent(gGLFWWindow);
glfwSwapInterval( 1 );

// Setting this is necessary for core profile (tested with MSVC 2013 x64, Windows 7)
glewExperimental = GL_TRUE;
// GLEW wraps all OpenGL functions and extensions
GLenum err = glewInit();
if(err != GLEW_OK)
{
  std::cerr<<"Failed to initialize GLEW"<<std::endl;
  std::cerr<<(char*)glewGetErrorString(err)<<std::endl;
  glfwTerminate();
  return -1;
}
glGetError(); //GLEW might cause an 'invalid enum' error, safely ignore it?

// Print OpenGL context information to console
ogl::printContextInformation();

// Perform our initialization (OpenGL states, shader, camera, geometry)
if(!init())
  return -1;

在这一行失败:

gGLFWWindow = glfwCreateWindow(gWidth,gHeight,"GLFW OpenGL Window",nullptr,nullptr);

有人知道我可以做些什么来解决这个问题吗?

答案是:我请求的是 Core 3.3 上下文,而我的版本是 OpenGL 3.1。 Deleting/commenting 这些行可以解决问题:

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

我遇到了同样的问题,因为我的上一台机器有 3.3 版的 openGl,现在因为我现在使用的是 openGl 3.1,这让我几乎感到沮丧 但是取消注释“window 提示”,它解决了问题