I have been experimenting with off screen rendering under Ubuntu 20.04 LTS and VTK 9.0.1 installed on Python 3.8 using pip3 install. I have simply set SetOffScreenRendering(1) on a rendering window on a small example. When the example is run it causes a core dump.
I am wondering, does the PYPi distribution of VTK support off screen at all? Should I recompile VTK with appropriate settings for having off screen working?
Thanks so much for providing the example code. When I tried the code you have provided it causes a core dump. The system I am testing it on is a vSphere virtual machine with attached 4 GPUs (used for DeepLearning, not for display). I will try this on a VM with not GPU (and nvidia drivers attached) to see if that changes things. If it does I am still not sure how to fix the problem, but at least I would know it is related to the presence of certain drivers.
Can it simply be that you have no running X server on your vSphere VM? I believe an X server must still be running for rendering to work. E.g. if I run with DISPLAY unset:
(studioenv) estan@edison:~$ python3 offscreen.py
2021-04-24 13:33:39.712 ( 0.137s) [ D10BE740]vtkXOpenGLRenderWindow.:449 ERR| vtkXOpenGLRenderWindow (0x1329f60): bad X server connection. DISPLAY=
Aborted (core dumped)
(studioenv) estan@edison:~$
And I believe this is to be expected (someone correct me if I’m wrong).