Hello, I have succesfully build a FEniCS Docker container incluiding vktplotter, but when I try to use vtkplotter I encounter the error:
ERROR: In /work/standalone-x64-build/VTK-source/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx, line 1223 vtkXOpenGLRenderWindow (0x24992f0): bad X server connection. DISPLAY=Aborted (core dumped)
It appears that vtkplotter or vtk can not run without the X server. Is there any way to solve this issue?
I'm afraid this is related to the X server trying to export the display...
Check out https://discourse.paraview.org/t/pvpython-bad-x-server-connection/849/5
I am using offscreen=True in my plotting command but the error persists.
I will try to run an X server inside the Docker container, lets see what happen. But if there is a shortcut I will appreciate the info
Hello Marco, there is a way to only store images rendered by vtkplotter without using the X server?
something like this:
import vtkplotter.dolfin as vtkplot
vtkplot.plot(u, offscreen=True, azimuth=-30.0, elevation=30.0, axes=0)
vtkplot.screenshot(filename='./outputVTK/u.png')
I'm not sure but I suspect that it might not be possible..
Hi Marco, I was able to build the Docker container with FEniCS and vtkplotter and to render using SSH with X11 forwarding. I don't know what will be the best way to share this info with you an others I think I will make a post in the FEniCS forum. What do you think?
Hi, that would be great if you have a recipe to share it could be followed by others.. I guess this is the thread: https://fenicsproject.discourse.group/t/how-to-add-a-python-module-to-the-fenics-docker-container/1665/2
thanks!
Marco
Hi, marcomusy.
How to render on the server(Ubuntu 16.04.6 LTS)?
There is a large amount of data on the server to be checked, Blender (cycle) and pyrender are time consuming(compared with vtkplotter locally), but I don't know how to set it up for offscreen rendering on the server.

Hi @LogWell
From the above discussion and related links I get that you need X11 to be able to save screenshots even if no window is opened.
I understand that @SiriusFuenmayor has already found way to do it.
I don't see any clear instructions on how to make this work yet, so I'm just reporting what worked for me on ubuntu 18.04 server. This is based on the instructions provided for pyvista: https://docs.pyvista.org/getting-started/installation.html
sudo apt-get install libgl1-mesa-dev xvfb
#!/bin/bash
set -x
export DISPLAY=:99.0
which Xvfb
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
sleep 3
set +x
exec "$@"
I saved the code above as /etc/rc.local and used chmod +x to make it executable. It does throw an error during startup but it does work.
vp.settings.notebookBackend = False
vp.settings.screeshotScale = 2
offscreen = vp.Plotter(axes=0, offscreen=True, size=(h,w))
offscreen.add(actors)
offscreen.show(camera=camera)
for r in offscreen.renderers:
r.SetBackground(1,1,1)
r.UseFXAAOn()
vp.screenshot(filename)
Most helpful comment
I don't see any clear instructions on how to make this work yet, so I'm just reporting what worked for me on ubuntu 18.04 server. This is based on the instructions provided for pyvista: https://docs.pyvista.org/getting-started/installation.html
sudo apt-get install libgl1-mesa-dev xvfb#!/bin/bashset -xexport DISPLAY=:99.0which XvfbXvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &sleep 3set +xexec "$@"I saved the code above as /etc/rc.local and used chmod +x to make it executable. It does throw an error during startup but it does work.
vp.settings.notebookBackend = Falsevp.settings.screeshotScale = 2offscreen = vp.Plotter(axes=0, offscreen=True, size=(h,w))offscreen.add(actors)offscreen.show(camera=camera)for r in offscreen.renderers:r.SetBackground(1,1,1)r.UseFXAAOn()vp.screenshot(filename)