Plot's axes not shown in Slicer 4.13 (but works with 4.11)


I wanted to report that in Slicer 4.13.0-2021-08-27 plot’s axes are not visible but in the same time Slicer 4.11.20210226 (stable release as I remember) works fine:
The code I have used is from the documentation
Ubuntu 20.04

Thanks for reporting :+1:

The axes are visible in a recent preview on mac.

But on my ubuntu 20.04 with a current build I get the missing axes and this message:

Generic Warning: In /home/pieper/slicer4/latest/Slicer-superbuild/VTK/Rendering/OpenGL2/vtkOpenGLFramebufferObject.cxx, line 1390
failed at glBlitFramebuffer 1 OpenGL errors detected
  0 : (1282) Invalid operation

Generic Warning: In /home/pieper/slicer4/latest/Slicer-superbuild/VTK/Rendering/OpenGL2/vtkOpenGLFramebufferObject.cxx, line 1390
failed at glBlitFramebuffer 1 OpenGL errors detected
  0 : (1282) Invalid operation

This looks like a VTK incompatibility of some kind. It would be good to check if it can be reproduced in pure VTK and reported there.

1 Like

Forget to mention that I also get this error.

To clarify a little: you mean to build Slicer with VTK from original git repository tagged under v9.1.0? If so I think I could do that.
As I can see Slicer uses custom VTK from Slicer’s repo

I meant it would be good to know if this is an issue with VTK itself, or something related to Slicer’s edits or the way we build it. You could try starting with a pure VTK example to see if you get the same issues.

1 Like

It seems that VTK 9 which is used by Slicer under git tag 98d686bb509f46543ebe04fdd5d120fdab87893b (slicer-v9.0.20201111-733234c785-v3) works fine with the given example:

I should mention that the script given by VTK is in fact needed as without it the app breaks at start:

  # vtk_module_autoinit is needed
    TARGETS LinePlot

the error without vtk_module_autoinit:
2022-01-17 02:04:48.988 ( 0.051s) [ 5E1A0940] vtkContextDevice2D.cxx:32 WARN| Error: no override found for ‘vtkContextDevice2D’.
Segmentation fault (core dumped)

Thanks for checking - this suggests maybe it’s something about VTK and Qt at the OpenGL level. If you have more time to look at this you might explore porting that example to CTK or ideally a native VTK/Qt example to see what exactly is broken.


I just downloaded the VTK Qt BarChartQt example and build it preliminary added find_package(Slicer REQUIRED) to the CMakeLists.txt. This allows to find VTK and Qt that were used to compile Slicer (Slicer’s custom VTK).
The example works fine:

The example uses QVTKOpenGLNativeWidget and sets QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());
I don’t know how excatly OpenGL related staff works but here are my thoughts (I write this maybe because probably I will refer to this later):

  • qMRMLWidget set some QSurfaceFormat property and it differs for Windows;

  • Slicer uses QVTKOpenGLNativeWidget through ctkVTKOpenGLNativeWidget (inherits QVTKOpenGLNativeWidget) wich in concluded in macros and in my case it looks this way:

  • ctkVTKChartView inherits from ctkVTKOpenGLNativeWidget

  • qMRMLPlotView inherits from ctkVTKChartView

I have tested all of these VTK OpenGL widgets (QVTKOpenGLNativeWidget, ctkVTKOpenGLNativeWidget, ctkVTKChartView, qMRMLPlotView) and all of them work.

I uploaded this slightly modified BarChartQt_Slicer example so you can try to configure and build it using cmake .. -DSlicer_DIR=/path/to/Slicer-build and the application should be run from Slicer environment ./Slicer --launch BarChartQt (I usually laucn vscode this way ./Slicer --launch code and then I can simply run the app using ./BarChartQt from the build folder)

The modifications are made in CMakeLists.txt aimed to find Slicer and CTK and link them.
And in BarChartQt where I do include <> and delete QVTKOpenGLNativeWidget and create any derived widget (code lines 50-107).

I just rebuilt Slicer with the newest commit d14f18f386f83943d6717cedb5d18f1ce423cada and noticed the problem seems to be solved.

Thank you

Oh, it seems I simply didn’t notice the warnings even though the axes are shown:

Generic Warning: In /home/kerim/Documents/Colada/d/VTK/Rendering/OpenGL2/vtkOpenGLState.cxx, line 1069
Error glEnable/Disable1 OpenGL errors detected
  0 : (1282) Invalid operation

 with stack trace of
0x7f7d4638400c : ??? [(???) ???:-1]
0x7f7d4637e921 : vtksys::SystemInformation::GetProgramStack[abi:cxx11](int, int) [( ???:-1]
0x7f7d50c7a03a : ??? [(???) ???:-1]
0x7f7d50c7ddb2 : vtkOpenGLState::SetEnumState(unsigned int, bool) [( ???:-1]
0x7f7d50b02707 : ??? [(???) ???:-1]
0x7f7d50c812d3 : vtkOpenGLState::vtkglBlitFramebuffer(int, int, int, int, int, int, int, int, unsigned int, unsigned int) [( ???:-1]
0x7f7d50d19897 : vtkTextureObject::CopyFromFrameBuffer(int, int, int, int, int, int) [( ???:-1]
0x7f7d50b946c0 : vtkOpenGLFXAAFilter::LoadInput() [( ???:-1]
0x7f7d50b939c3 : vtkOpenGLFXAAFilter::Execute(vtkOpenGLRenderer*) [( ???:-1]
0x7f7d50c5689c : vtkOpenGLRenderer::UpdateGeometry(vtkFrameBufferObjectBase*) [( ???:-1]
0x7f7d50c55a51 : vtkOpenGLRenderer::DeviceRender() [( ???:-1]

and it continues for many many lines

You can try disabling FXAA anti-aliasing and see if the messages go away. It is turned on in Slicer or CTK, you should be able to find it by searching for FXAA.

1 Like