Posting this in Slicer3D forum for better visibility. Please feel free to move it to appropriate category where it’s more visible.
We’re looking to update the minimum required OpenGL version in VTK from 3.2 to 4.1 for the desktop platforms. I’m cross posting here to gather feedback because Slicer3D uses VTK and also has a large community.
Since VTK uses a core profile context and asks for the highest available version of OpenGL from the OS, chances are you’re already using 4.6. Please let us know if your team requires VTK to support GPUs with OpenGL 4.0 or lower. We could look into the use case if needed and make necessary updates.
This backward compatibility is starting to hamper the introduction of newer robust rendering capabilities like tessellation shaders, compute shaders, etc. In the future, VTK will move over to WebGPU, however, that is a long term goal, best discussed in another post.
Here are some resources to get the general idea of systems supporting OpenGL 4.1
Thanks for the heads-up! I don’t expect that this will cause an issue when Slicer is running on physical hardware that is not older than 5 years, but it might cause incompatibility issues in virtualized environments (virtualGL, VirtualBox, Parallels, etc.).
It would be difficult to test all environments where Slicer is used. If you want to ensure a smooth transition for every applications then you could do something like this:
change VTK now to require OpenGL 4.1 by default
add a CMake flag that allows using VTK with just OpenGL 3.2 (it is OK to disable any new VTK features in this mode)
These can use mesa3d (on windows too [1]). It provides software implementation for OpenGL 4.1+
Yes, this is possible. VTK can force the OpenGL context to 3.2 and it can be controlled with a compile-time setting. (also possible at runtime, just need a new Set/Get macro)
Can you suggest a test program (e.g. glxgears, blender, maybe a game or something) that people could run to see if this change will break something for them? If there isn’t something already could we make one? I don’t think most people know or care what OpenGL version they use unless it breaks.
There is one already. vtkProbeOpenGLVersion can be found inside bin/ directory of a VTK installation. When you run it, it will print lots of information or show a dialog on windows. So look for this line:
OpenGL version string: 4.5 (Core Profile) Mesa 24.0.1-arch1.1
Thanks @jspanchu - just trying to make sure this is clear for people who aren’t in the weeds of OpenGL.
So if I run the python script you provided in Slicer 5.6.1 my mac pro, I get the following, which is consistent with the expectation that 4.1 should be supported.
...
OpenGL version string: 4.1 ATI-4.12.7
...
So what we need is for people to check this out and report back if they see a version string less than 4.1. It’s possible this might happen with older machines, virtualized environments, or specific remote desktop systems.
it will be helpful to know if those systems exist, but it may also be the case that we move ahead anyway and just let people know that they may need to use older Slicer/VTK versions with those systems.
Could you set up a build with this 3.2 option enabled so that you know what is broken - and if it is not too much trouble then keep most things working with OpenGL 3.2 for a transition period of 2 years? I would expect that most incompatibilities will be introduced accidentally and should be easy to avoid (maybe by adding a few #ifdefs, which can be all wiped out once the transition period is over).