通过 SSH 连接的 OpenGL 问题

Problem with OpenGL through SSH connection

我正在尝试在 client/server 模式下使用软件 (Paraview),在我的桌面计算机 (linux, debian 10) 上打开客户端,并在远程服务器上进行大量计算 ( linux, CentOS 8).该软件需要 OpenGL 3.2 或更高版本的实现,并且我的机器上安装的软件应该没问题,正如您从下面显示的命令 glxinfo 的输出中看到的那样:

myaccount@desktopmachine:$ glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: *GeForce GTX 650 Ti BOOST/PCIe/SSE2 OpenGL core*
profile version string: 4.6.0 NVIDIA 440.82 OpenGL core profile
shading language version string: 4.60 NVIDIA OpenGL core profile
context flags: (none) OpenGL core profile profile mask: core profile
OpenGL core profile extensions: OpenGL version string: 4.6.0 NVIDIA
440.82 OpenGL shading language version string: 4.60 NVIDIA OpenGL context flags: (none) OpenGL profile mask: (none) OpenGL extensions:
OpenGL ES profile version string: **OpenGL ES 3.2** NVIDIA 440.82 OpenGL
ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:

问题是,当通过 SSH 连接到远程服务器时,同一命令产生的 OpenGL 是:

myaccount@server:$ glxinfo | grep "OpenGL"
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: *GeForce GTX 650 Ti BOOST/PCIe/SSE2 OpenGL*
version string: **1.4** (2.1.2 NVIDIA 440.82) OpenGL extensions:

看来OpenGL的版本没有正确传输。 我应该怎么做才能解决这个不允许我 运行 软件的问题?

SSH 隧道 X11。 GLX 是执行 OpenGL 的 X11 协议扩展,也是将 OpenGL 调用封装到 X11 中的协议,然后通过 SSH 隧道传输。

事情是这样的:

GLX 仅支持 OpenGL-1.4(https://www.khronos.org/registry/OpenGL/specs/gl/glx1.4.pdf 第 49 页)。 直接渲染支持 [=25] =] 上下文和 GLX 仅用于设置上下文,但从那里开始,与 OpenGL-3.x 及以后的所有内容都绕过 GLX 并直接进入驱动程序。

当然,理论上可以更新 GLX 以支持 OpenGL-3 及更高版本。但是没有人打扰。

你现在的选择是 运行 远程端的所有内容,只传输渲染结果。理想情况下,这将通过创建无 X、无头 OpenGL 上下文的应用程序来完成,然后将渲染结果复制到 X11 SHM 像素图中(但是,在您的典型网络上,性能将很糟糕)。

我的首选解决方案是使用 Xpra,在远程端使用 GPU。

在 ParaView 和 pvserver 的上下文中,您需要使用本地显示,而不是 "X11 forwarding" 机制。

连接时不要使用-X-Y然后运行DISPLAY=:0 glxinfo,DISPLAY=:0 pvserver。在你的服务器上