如果正在运行的计算机上支持 opengl 4,我想检测我的 C++ 程序内部。
我不知道我是否在 google 和 stackoverflow 上搜索错误/不好的术语(我的英语技能......),但令人惊讶的是我没有找到任何例子......如果你告诉我这个问题我不会感到惊讶是一个重复...
知道如何从显卡和它在运行的计算机上使用的驱动程序获取更多有用的数据最终对我很有用。我没有花时间环顾四周,知道如何做到这一点,但如果你有一些有用的链接,请随时与我分享。
如果正在运行的计算机上支持 opengl 4,我想检测我的 C++ 程序内部。
我不知道我是否在 google 和 stackoverflow 上搜索错误/不好的术语(我的英语技能......),但令人惊讶的是我没有找到任何例子......如果你告诉我这个问题我不会感到惊讶是一个重复...
知道如何从显卡和它在运行的计算机上使用的驱动程序获取更多有用的数据最终对我很有用。我没有花时间环顾四周,知道如何做到这一点,但如果你有一些有用的链接,请随时与我分享。
Step 1: Create an OpenGL Context; first try by the "attrib" method requesting the minium OpenGL version you want to have. If that succeeds you're done.
Step 2: If that didn't work and you can gracefully downgrade create a no-frills context
and call glGetString(GL_VERSION)
to get the actual context version supported. Note that on MacOS X this limits you to 2.1 and earlier.
Step 3: If you want some context, portable and reliably between 2.1 and your optimimal version, try with the attribs method in a loop, decrementing your needs until it succeeds.
Note that there is no way to determine in advance which version is supported in OpenGL. The main reason for this is, that operating systems and the graphics layer may decide on demand which locally available OpenGL version to use, depending on the request and the resources available at the moment (graphics cards in theory can be hotplugged).