1

我想创建 OpenGL 1.2 上下文,但我收到此错误:“无法打开 GLFW 窗口”。当我创建 3.3 或 4.3 上下文时没有问题。如何创建 1.2 上下文?

glfwWindowHint(GLFW_SAMPLES, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 1);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

const GLFWvidmode * mode = glfwGetVideoMode(glfwGetPrimaryMonitor());
WindowWidth = mode->width;
WindowHeight = mode->height;
midWindowWidth = WindowWidth / 2;
midWindowHeight = WindowHeight / 2;



window = glfwCreateWindow(WindowWidth, WindowHeight, "Quadcopter Project", glfwGetPrimaryMonitor(), NULL);
if( window == NULL )
{
    fprintf( stderr, "Failed to open GLFW window. \n" );
    glfwTerminate();
    return -1;
}
4

1 回答 1

3

OpenGL < 3.2 中没有配置文件。您无法创建 1.2 核心配置文件,因为没有这样的东西。

您也不能直接强制驱动程序创建 1.2 上下文。请求特定上下文版本的功能是在 3.0 中引入的。所以基本上,3.0 之前的一切都只是一些遗留上下文。您可以要求 1.2,但它可能会为您提供更高的(兼容性配置文件)上下文,具体取决于您尝试使用的平台和驱动程序。

于 2014-07-13T14:50:23.690 回答