CylinderExample vtkXOpenGLRenderWindow error in C++

I’m running Ubuntu 20.04 on WSL. I succesfully compile the CylinderExample, and get the following errors at runtime.

2021-06-04 19:05:43.417 (   0.009s) [        A4169740]vtkXOpenGLRenderWindow.:251    ERR|  vtkXOpenGLRenderWindow (0x55ef95e7e380): Could not find a decent config

2021-06-04 19:05:43.417 (   0.009s) [        A4169740]vtkXOpenGLRenderWindow.:468    ERR| vtkXOpenGLRenderWindow (0x55ef95e7e380): Could not find a decent visual

Are you running it inside a graphical interface (X) or are you headless?

You’ll need to install an xserver before you can run graphical programs in WSL.
There are instructions on the internet on how to do that.

Not that the installed server uses software rendering so they will be slower than using your graphics card.
Note that you can run VTK directly on Windows though.

Dan

I have Ximing Xserver installed and running, and I can successfully Render xclock and OpenGL examples from Ubuntu.

And I also I have the libx11-xcb1 and the libx11-xcb-dev libraries installed on the Ubuntu distro.

I’m very doubtful that Xming has sufficient OpenGL capabilities for VTK applications. What version of OpenGL does it show when you run glxinfo? It should report something like this:

OpenGL version string: 4.5

I wonder if xvfb-run might be a better solution.

If anyone has specific instructions/experience successfully running ParaView/VTK with WSL, I would be very interested - it would avoid dual-boot with linux headaches.

I just tried running paraview within xvfb, and it seems to run perfectly (this is on an actual linux box, not WSL, but that shouldn’t make a difference). Using xvfb to run glxinfo gives me the following, which shows the capabilities of the software OpenGL renderer that xfvb uses:

$ xvfb-run glxinfo | grep OpenGL
OpenGL vendor string: Mesa/X.org
OpenGL renderer string: llvmpipe (LLVM 11.0.0, 256 bits)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 20.2.6
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:
OpenGL version string: 3.1 Mesa 20.2.6
OpenGL shading language version string: 1.40

If something is running in xvfb, it is possible to pipe it out via vnc. As a very crude test with paraview, I did this:

xvfb-run -n 99 -f /tmp/Xauthority.99 /path/to/paraview &
x11vnc -display :99 -auth /tmp/Xauthority.99 &

From there, I could use a VNC viewer to connect to x11vnc over port 5900, and thereby view and control paraview.

I’m sure that there are tidier ways of putting xvfb and vnc together, but the above serves as a proof-of-concept.

server glx version string: 1.2
client glx version string: 1.4
GLX version: 1.2
Max core profile version: 4.5
Max compat profile version: 3.1
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.2
OpenGL version string: 3.1 Mesa 20.2.6
OpenGL shading language version string: 1.40

The OpenGL version looks sufficient, but the glx version does not:

I recall that VTK has required glx 1.3 or higher since around 2003.

If you’re looking for offline software renders (no GUI or display) install these:

sudo apt install mesa-common-dev libosmesa6-dev libglu1-mesa-dev

Then build VTK with OSMESA.

XServer’s definitely the way to go for GUI right now. But Microsoft is working on GPU and GUI support for WSL 2.0! I believe it’s in their insider program still. Would be very interested in seeing VTK work on there. Also seeing it with EGL for headless.

I want to be able to display GUIs for debugging. Should I still install: mesa-common-dev, libosmesa6-dev and libglu1-mesa-dev?

no. XServer is the way to go if you want GUI.

With the understanding that you can either:

  1. Run the xserver on the windows side, but for VTK 9 you will require an xserver that provides glx 1.4
  2. Run the xserver on the linux side, and use e.g. vnc to do the remote viewing
  3. Wait until Microsoft provides their own solution to for a WSL GUI

So if I just want to do local visualizations, I shouldn’t need to setup VNC?

No, I’m pretty sure that you do need vnc. Because if you use xvfb to create a local xserver like in my paraview example above, then you still need some way to view the xvfb framebuffer. That’s where vnc comes in.

It’s possible to run a full X session inside xvfb, which will give you a complete linux desktop that you can connect to via vnc.

Using VcXsrv I got it to work!