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

时间:2016-09-26 13:54:14

标签: c++ opengl glfw

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

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

我的问题可能是驱动程序问题。我尝试更新它们(使用英特尔驱动程序更新实用程序),但它没有做到这一点(我的驱动程序似乎已经是最新的)。我使用内置的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);

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

2 个答案:

答案 0 :(得分:1)

答案是:我正在申请Core 3.3上下文,而我的版本是OpenGL 3.1。 删除/评论这些行将起到作用:

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);

答案 1 :(得分:0)

我遇到了同样的问题,因为我的最后一台计算机具有版本3.3的openGl,而现在由于正在使用的计算机而具有openGl 3.1,这使我几乎感到沮丧 但是去掉“窗口提示” enter image description here,就可以解决问题