Issues with VTK / OSMesa on Linux
I'm attempting to call draw3D() on the Cooke Triplet example, and receive the following error (running Linux Mint 22 x86_64):
2025-05-06 11:06:04.568 ( 2.362s) [ 7E6E1755A600]vtkXOpenGLRenderWindow.:256 ERR| vtkXOpenGLRenderWindow (0x2b3233a0): Could not find a decent config
2025-05-06 11:06:04.568 ( 2.362s) [ 7E6E1755A600]vtkXOpenGLRenderWindow.:502 WARN| vtkXOpenGLRenderWindow (0x2b3233a0): Could not find a decent visual
2025-05-06 11:06:04.577 ( 2.371s) [ 7E6E1755A600] vtkEGLRenderWindow.cxx:385 WARN| vtkEGLRenderWindow (0x2b2c5770): Setting an EGL display to device index: -1 require EGL_EXT_device_base EGL_EXT_platform_device EGL_EXT_platform_base extensions 2025-05-06 11:06:04.577 ( 2.371s) [ 7E6E1755A600] vtkEGLRenderWindow.cxx:390 WARN| vtkEGLRenderWindow (0x2b2c5770): Attempting to use EGL_DEFAULT_DISPLAY... 2025-05-06 11:06:04.577 ( 2.371s) [ 7E6E1755A600] vtkEGLRenderWindow.cxx:395 WARN| vtkEGLRenderWindow (0x2b2c5770): Could not initialize a device. Exiting... 2025-05-06 11:06:04.577 ( 2.371s) [ 7E6E1755A600]vtkOpenGLRenderWindow.c:793 WARN| vtkEGLRenderWindow (0x2b2c5770): Failed to initialize OpenGL functions! 2025-05-06 11:06:04.577 ( 2.371s) [ 7E6E1755A600]vtkOpenGLRenderWindow.c:812 WARN| vtkEGLRenderWindow (0x2b2c5770): Unable to find a valid OpenGL 3.2 or later implementation. Please update your video card driver to the latest version. If you are using Mesa please make sure you have version 11.2 or later and make sure your driver in Mesa supports OpenGL 3.2 such as llvmpipe or openswr. If you are on windows and using Microsoft remote desktop note that it only supports OpenGL 3.2 with nvidia quadro cards. You can use other remoting software such as nomachine to avoid this issue. 2025-05-06 11:06:04.586 ( 2.380s) [ 7E6E1755A600]vtkOSOpenGLRenderWindow:152 WARN| libOSMesa not found. It appears that OSMesa is not installed in your system. Please install the OSMesa library from your distribution's package manager.
Running "glxinfo | grep OpenGL" gives the following output:
OpenGL vendor string: AMD OpenGL renderer string: AMD Radeon 660M (radeonsi, rembrandt, LLVM 19.1.1, DRM 3.57, 6.8.0-58-generic) OpenGL core profile version string: 4.6 (Core Profile) Mesa 24.2.8-1ubuntu124.04.1 OpenGL core profile shading language version string: 4.60 OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL core profile extensions: OpenGL version string: 4.6 (Compatibility Profile) Mesa 24.2.8-1ubuntu124.04.1 OpenGL shading language version string: 4.60 OpenGL context flags: (none) OpenGL profile mask: compatibility profile OpenGL extensions: OpenGL ES profile version string: OpenGL ES 3.2 Mesa 24.2.8-1ubuntu124.04.1 OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20 OpenGL ES profile extensions:
So I have Mesa installed, and have confirmed that I have libosmesa-6 installed from my package manager. VTK doesn't seem to be finding my XOpenGL installation, and then falls through to the EGLRenderWindow and then OSOpenGLRenderWindow methods, which it also cannot succeed with. This follows the Linux order of render window attempts described here (https://docs.vtk.org/en/latest/build_instructions/build_settings.html).
Any advice on configuring VTK appropriately to run Optiland is appreciated!
Hi @jfollans,
Thanks for looking into this and for sharing all the details. I’ll be honest - I’m not very familiar with Linux graphics internals or how VTK handles its rendering backends in that environment. I develop on Windows, so I haven’t really run into these kinds of OpenGL or OSMesa issues before.
The only place I’ve ever run Optiland on Linux is through GitHub Actions (on ubuntu-latest), where everything works - but that’s a headless CI setup, and it doesn’t do any 3D plotting. So unfortunately I can’t draw much insight from that when it comes to rendering or OpenGL contexts.
It seems like this is heading into low-level system config territory, which I’m not well-equipped to debug. Perhaps there is a user out there that has encountered this and can comment. In any case, if you do end up figuring it out, I’d be super grateful if you’d be willing to share your solution so I can include it in the documentation for others in the future.
Best of luck, and thanks for trying out Optiland!
Regards, Kramer
I will close this issue due to inactivity. Feel free to open another issue should you have any other questions.