【问题标题】:GLFW: profile requested but WGL_ARB_create_context_profile is unavailableGLFW:已请求配置文件,但 WGL_ARB_create_context_profile 不可用
【发布时间】:2017-02-03 21:56:40
【问题描述】:

由于以下错误消息(我在 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);

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

【问题讨论】:

  • 如果您只有 OpenGL 3.1,为什么要请求 Core 3.3 上下文?
  • 因为我不理解所有这些代码(它是给我的,我必须从中工作),但你实际上是对的。我评论了这些行,它成功了,谢谢!

标签: c++ opengl glfw


【解决方案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);

【讨论】:

    【解决方案2】:

    我遇到了同样的问题,因为我的上一台机器有一个 3.3 版的 openGl,而现在因为正在使用的那个现在有,但是一个 openGl 3.1 让我几乎感到沮丧 但是取消注释“窗口提示”enter image description here,它解决了问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-10-13
      • 2015-08-02
      • 2013-11-27
      • 1970-01-01
      • 1970-01-01
      • 2020-09-27
      • 2017-10-21
      相关资源
      最近更新 更多