加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

windows – 如何使用特定的图形驱动程序创建OpenGL上下文?

发布时间:2020-12-14 02:46:02 所属栏目:Windows 来源:网络整理
导读:某些计算机安装了多个图形卡/芯片组,即使(例如笔记本电脑)它们没有多个显示器. 我在使用具有Intel和Nvidia图形硬件的笔记本电脑系统时遇到了麻烦.英特尔的驱动程序在OpenGL支持方面非常糟糕,我的代码遇到了一个无法解释的渲染错误,因为在创建渲染上下文时,它
某些计算机安装了多个图形卡/芯片组,即使(例如笔记本电脑)它们没有多个显示器.

我在使用具有Intel和Nvidia图形硬件的笔记本电脑系统时遇到了麻烦.英特尔的驱动程序在OpenGL支持方面非常糟糕,我的代码遇到了一个无法解释的渲染错误,因为在创建渲染上下文时,它似乎默认为Intel系统,而不是Nvidia系统.

有没有办法在启动时避免这种情况?要说“对所有可用的图形驱动程序进行轮询,尽可能避免使用英特尔驱动程序,并使用可行的驱动程序构建一个OpenGL渲染上下文”?

解决方法

没有可移植的方式来做你要求的,但是这个文档描述了如何在使用NVIDIA Optimus技术的系统上强制“高性能图形渲染”:

http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf

具体来说,请参阅“全局变量NvOptimusEnablement”(驱动程序中的新增内容)部分
发布302)“,其中说:

Starting with the Release 302 drivers,application developers can
direct the Optimus driver at runtime to use the High Performance
Graphics to render any application–even those applications for which
there is no existing application profile. They can do this by
exporting a global variable named NvOptimusEnablement . The Optimus
driver looks for the existence and value of the export. Only th e LSB
of the DWORD matters at this time. A value of 0x00000001 indicates
that rendering should be performed using High Performance Graphics. A
value of 0x00000000 indicates that this method should be ignored.

用法示例:

extern "C" {
    _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
}

另一种可能性是WGL_nv_gpu_affinity扩展,但您的WGL上下文需要支持它,我不确定它是否适用于混合的Intel / NVIDIA系统:

http://developer.download.nvidia.com/opengl/specs/WGL_nv_gpu_affinity.txt

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读