glutInitContextVersion的文档在哪里? [英] Where is the documentation for glutInitContextVersion?

查看:156
本文介绍了glutInitContextVersion的文档在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

FreeGLUT API文档没有包含glutInitContextVersion的条目,当我搜索它时,我发现的只是一系列问题,这些问题不能直接解决其用途或效果.

The FreeGLUT API documentation does not include an entry for glutInitContextVersion and when I google for it, all I find are a list of questions which don't directly address its usage or effects.

它记录在任何地方吗?

推荐答案

glutInitContextVersion不是官方GLUT API的一部分(完全过时),而是freeglut添加的非官方扩展名.但是,一旦知道OpenGL的上下文版本是如何工作的,它的用法就很简单了,这在

glutInitContextVersion is not part of the official GLUT API (which is btw. completely outdated), but an unofficial extension added by freeglut. However, its usage is quite straight-forwadd as soon as one knows about how OpenGL's context versions work, which was defined in the ARB_create_context familiy of extensions.

该函数将在实际创建上下文时选择请求哪个OpenGL版本.请注意,这不需要实现返回与您所请求的版本完全相同的上下文,而是应返回与请求的版本兼容的上下文,以便该版本的所有功能都存在.

The function will select which OpenGL version is requested when the context is actually created. Note that this does not require the implementation to return a context with exactly the version you are requesting, but it should return one that is compatible to the requested version, so that all features of that version are present.

关于freeglut处理此问题似乎有些不足.通过查看代码(对于当前的稳定版本2.8.1),您将看到freeglut实现了以下逻辑: 如果实现不能完全满足版本约束条件,但支持ARB_create_context扩展名,则它将产生一些错误,并且不会创建任何上下文.但是,如果请求版本,但是实现甚至不支持相关扩展,则会创建旧版GL上下文,从而有效地完全忽略了版本请求.这对我来说似乎有点矛盾.但是,由于尚未记录这些内容,也不属于GLUT规范的一部分,因此尚不清楚该行为将来是否会保持不变.

There are a few things which seem to be undocuemted about freeglut handling this. From looking into the code (for the current stable version 2.8.1), one will see that freeglut implements the following logic: If the implementation cannot fullfill the version constraints, but does support the ARB_create_context extension, it will generate some error and no context will be created. However, if a version is requested, but the implementation does not even support the relevant extensions, a legacy GL context is created, effectively ignoring the version request completely. This seems a bit inconsistent to me. However, as this stuff is not documented and not part of the GLUT spec, it is unclear if the behavior will stay the same in the future or not.

如果您不需要某些特定于GLUT的功能(无论如何,这些功能基本上都依赖于已弃用的OpenGL),则可能需要查看一些更现代的替代方法,例如

If you don't need some GLUT-specific features (which are basically all relying on deprecated OpenGL anyway), you'll might want to look at some more modern alternatives like GLFW.

这篇关于glutInitContextVersion的文档在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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