How can I display the vtk 3d volume rendering results onscreen in a remote connection with workstation(X11)?

Hi all. I’m newbee want to use vtk.
I think it’s a really good tool for 3d volume rendering, so I’m studying to use it.
I have a problem using it, so I leave a question.

I use X11 to connect workstation remotely from my local and sometimes nothing appears when I print 3d volume rendering results. I’ve been looking for some articles and it’s because we’re assigned a cpu-based ‘mesa’ instead of a gpu (rtx 2080ti) on our workstation for GPU rendering. As they say, if i print 3d rendering results directly on the server without remote access, this problem disappears. But I hope my rendering results will be printed in my local desktop with remote connection. Can I fix this problem by changing when I build vtk or something else? I found a way to turn off-screen rendering by not using x server. However, if I do this, the buffering is quite severe. Is there any way to do it on-screen? Please give me any advice.
Thank you.

First, make sure that the X server and the OpenGL libraries are good enough for VTK.

 $ glxinfo | less

You should see something like this:

name of display: :99
display: :99  screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
...
OpenGL vendor string: Mesa/X.org
OpenGL renderer string: llvmpipe (LLVM 12.0.0, 256 bits)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 21.0.3
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
...

The glx version should be 1.4, and the OpenGL version should be 4.5 or later.

If you use ssh to establish the X11 connection, then try both “-X” and “-Y”:

ssh -X someone@server.edu
ssh -Y someone@server.edu

Before and after making the connection, do echo $DISPLAY to make sure that an X11 display port is present.

If X11 still refuses to display a VTK rendering, there is still a chance that you can use xvfb and vnc instead of an X11 connection.

Thank you for your reply. Unfortunately, I’ve tried all the solutions you posted, but the problem hasn’t been fixed.

In glxinfo, only name of display part is different(You are 99 and I am 10.), but I think this part is unlikely to affect.
A little suspicious about glxinfo is that It’s set to accelerated:no in Extended rendere info, but I’m not sure if this will affect it. I’ve tried both -X and -Y, but the problem hasn’t been solved.

In fact, if I do not remote connect so without X11 connection, the problem will be resolved.
In this case, the gpu resources appear as follows:
GPU Vendor : NVIDIA Corporation
GPU Renderer : GeForce RTX 2080 Ti/PCIe/SSE2
GPU Version : 4.6.0 NVIDIA 460.91.03

It would be nice if I could force the assignment of these gpu vendors in the process of building vtk, but I don’t know how.
If you know, please leave a comment. If there’s no such way, I’ll have to find another way as you told me.

Thank you!

That’s not possible, unfortunately. The GPU vendor is discovered at runtime, it isn’t configured at build time. This is just the way that OpenGL is done on Linux: libglvnd automatically dispatches OpenGL calls to the appropriate hardware/software implementations at runtime.

You can try “export LIBGL_ALWAYS_SOFTWARE=1” or other GL environment variables to see if they have an effect.

Hmm… I just tried this on my own machine:

export LIBGL_ALWAYS_SOFTWARE=1

It works fine with VTK 9.0.3, but for VTK master, all I get is a black window.

Looks like a regression in master.

@cspark what version of VTK are you using?

Edit: the following settings (when used together) also result in a black window for master but not for release:

LIBGL_DRI3_DISABLE=1 LIBGL_DRI2_DISABLE=1