为什么两个终端显示不同的OpenGL版本?

huangapple go评论65阅读模式
英文:

Why two terminals show different OpenGL versions?

问题

I work on Ubuntu 20.04.

我在Ubuntu 20.04上工作。

I updated graphics drivers and restarted X. I had to upgrade OpenGL since after upgrading drivers the OpenGL version was downgraded for some reason. I opened bash terminal and updated the drivers as described here:

我更新了图形驱动并重新启动了X。我不得不升级OpenGL,因为在升级驱动程序后,由于某种原因,OpenGL版本被降级了。我打开了bash终端,并按照这里的说明更新了驱动程序:

sudo add-apt-repository ppa:kisak/kisak-mesa
sudo apt update
sudo apt upgrade

Now, when I run glxinfo | grep "OpenGL version" either on terminal opened from VSCode or from Ubuntu itself it shows version 4.5.

现在,当我在从VSCode打开的终端或者从Ubuntu本身打开的终端上运行glxinfo | grep "OpenGL version"时,它显示版本为4.5。

user@user:~$ glxinfo | grep "OpenGL version"
OpenGL version string: 4.5 (Compatibility Profile) Mesa 23.1.0 - kisak-mesa PPA

But, when I open the terminal from Qt Creator it shows version 3.1

但是,当我从Qt Creator打开终端时,它显示版本为3.1。

user@user:~$ glxinfo | grep "OpenGL version"
OpenGL version string: 3.1 Mesa 21.2.6

How this even possible?

这怎么可能呢?

英文:

I work on Ubuntu 20.04.

I updated graphics drivers and restarted X. I had to upgrade OpenGL since after upgrading drivers the OpenGL version was downgraded for some reason. I opened bash terminal and updated the drivers as described here:

sudo add-apt-repository ppa:kisak/kisak-mesa
sudo apt update
sudo apt upgrade

Now, when I run glxinfo | grep "OpenGL version" either on terminal opened from VSCode or from Ubuntu itself it shows version 4.5.

user@user:~$ glxinfo | grep "OpenGL version"
OpenGL version string: 4.5 (Compatibility Profile) Mesa 23.1.0 - kisak-mesa PPA

But, when I open the terminal from Qt Creator it shows version 3.1

user@user:~$ glxinfo | grep "OpenGL version"
OpenGL version string: 3.1 Mesa 21.2.6

How this even possible?

答案1

得分: 3

Qt Creator有自己的环境变量,用于在构建项目时加载。

LD_LIBRARY_PATHLIBGL_DRIVERS_PATH 中的路径指向 /snap/qtcreator-.../usr/lib/x86_64-linux-gnu/dri,其中包含比 /usr/lib/.../dri 中更新的图形驱动程序库。当Qt Creator启动的终端时,它会在那里查找驱动程序,而不是在新驱动程序已安装的 /usr/lib/... 中查找。

一旦我删除了 /snap/...Qt Creator允许在默认位置 /usr/lib/... 中查找OpenGL库,那里安装了新的驱动程序。

英文:

Qt Creator has its own environment variables that it loads when building a project.

LD_LIBRARY_PATH and LIBGL_DRIVERS_PATH had paths to /snap/qtcreator-.../usr/lib/x86_64-linux-gnu/dri which has older graphics driver libraries than in /usr/lib/.../dri. When the terminal from Qt Creator started, it looked for drivers there and not in /usr/lib/... where new drivers werer installed.

Once I removed that /snap/... it allowed Qt Creator to look for OpenGL libraries in the default location /usr/lib/... where new dirvers where installed.

huangapple
  • 本文由 发表于 2023年5月13日 11:28:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/76240941.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定