GLFW返回错误的GL_VERSION [英] GLFW returning the wrong GL_VERSION

查看:386
本文介绍了GLFW返回错误的GL_VERSION的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在GLFW中,我通过以下方式设置OpenGL上下文版本:

In GLFW I'm setting OpenGL context version via:

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);

但是,当我通过以下方式在glfwMakeContextCurrent(window);glewInit();之后将其打印到控制台时:

However when I print it to the console after glfwMakeContextCurrent(window); and glewInit(); via:

Log::brightWhite("OpenGL version:\t");
Log::white("%s\n", glGetString(GL_VERSION));
Log::brightWhite("GLSL version:\t");
Log::white("%s\n", glGetString(GL_SHADING_LANGUAGE_VERSION));

我得到以下信息:

为什么是4.3而不是2.0?

Why is it 4.3 and not 2.0?

推荐答案

因为该实现可以自由提供您喜欢的任何版本,只要它支持GL 2.0核心中的所有功能.通常,您将获得实施的受支持最高的 compatibilityty 配置文件版本.没问题.

Because the implementation is free to give you any version it likes, as long it is supporting everything which is in core GL 2.0. You typically will get the highsest supported compatibilty profile version of the implementation. There is nothing wrong with that.

请注意,在更高版本中添加了向前和向后兼容的上下文和配置文件,因此,在请求1.x/2.x上下文时,这是您应该采用的行为.请注意,在OSX,GL 3.X和更高版本中,仅核心配置文件支持上述功能,因此,您很可能最终会获得2.1上下文.

Note that forward and backward compatible contexts and profiles were added in later versions, so when requesting a 1.x/2.x context, this is the behavior you should expet. Note that on OSX, GL 3.X an above is only supported in core profile, so you will very likely end up with a 2.1 context there.

这篇关于GLFW返回错误的GL_VERSION的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆