gpt4 book ai didi

c++ - GLFW:请求配置文件但 WGL_ARB_create_context_profile 不可用

转载 作者:行者123 更新时间:2023-11-28 05:30:17 25 4
gpt4 key购买 nike

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

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。删除/评论这些行就可以了:

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

关于c++ - GLFW:请求配置文件但 WGL_ARB_create_context_profile 不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39704822/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com