Segm fault on Renderer render and RenderWindow Render

Hello VTK community, I reusing some parts of code from “Screenshoot” sample to visualise my mesh. I receive
Signal: SIGSEGV (Segmentation fault)
on the line
renderWindow->Render();

Additionally, I removed import “vtkRenderingContextOpenGL2” from CMakeLists as I don’t have this lib in my build.
Could someone help me to identify a problem? As I cannot see why I get segm fault if all objects are initialised.

Here Is a part of code where it occurred.

vtkSmartPointer mapper =
vtkSmartPointer::New();
mapper->SetInputData(this->mesh);

vtkSmartPointer<vtkActor> actor =
        vtkSmartPointer<vtkActor>::New();
actor->SetMapper(mapper);

vtkSmartPointer<vtkRenderer> renderer =
        vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow =
        vtkSmartPointer<vtkRenderWindow>::New();

renderWindow->AddRenderer(renderer);
renderWindow->SetAlphaBitPlanes(1); //enable usage of alpha channel

vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
        vtkSmartPointer<vtkRenderWindowInteractor>::New();
renderWindowInteractor->SetRenderWindow(renderWindow);

renderer->AddActor(actor);
renderer->SetBackground(1,1,1); // Background color white

**renderWindow->Render();**

Error in Renderer render:

021-03-19 13:45:26.539 ( 7.829s) [ 28544180] vtkOpenGLState.cxx:63 WARN| Error in cache state for GL_DEPTH_WRITEMASK
2021-03-19 13:45:26.539 ( 7.829s) [ 28544180] vtkOpenGLState.cxx:72 WARN| Error in cache state for GL_COLOR_WRITEMASK
2021-03-19 13:45:26.539 ( 7.829s) [ 28544180] vtkOpenGLState.cxx:79 WARN| Error in cache state for GL_BLEND
2021-03-19 13:45:26.539 ( 7.829s) [ 28544180] vtkOpenGLState.cxx:86 WARN| Error in cache state for GL_DEPTH_TEST
2021-03-19 13:45:26.539 ( 7.829s) [ 28544180] vtkOpenGLState.cxx:109 WARN| Error in cache state for GL_SCISSOR_TEST
2021-03-19 13:45:26.539 ( 7.829s) [ 28544180] vtkOpenGLState.cxx:132 WARN| Error in cache state for GL_VIEWPORT
2021-03-19 13:45:26.539 ( 7.829s) [ 28544180] vtkOpenGLState.cxx:140 WARN| Error in cache state for GL_SCISSOR_BOX
2021-03-19 13:45:26.539 ( 7.829s) [ 28544180] vtkOpenGLState.cxx:147 WARN| Error in cache state for GL_CULL_FACE_MODE
2021-03-19 13:45:26.539 ( 7.829s) [ 28544180] vtkOpenGLState.cxx:154 WARN| Error in cache state for GL_ACTIVE_TEXTURE
2021-03-19 13:45:26.539 ( 7.829s) [ 28544180] vtkOpenGLState.cxx:161 WARN| Error in cache state for GL_DEPTH_FUNC
2021-03-19 13:45:26.539 ( 7.829s) [ 28544180] vtkOpenGLState.cxx:168 WARN| Error in cache state for GL_BLEND_SRC_RGB
2021-03-19 13:45:26.539 ( 7.829s) [ 28544180] vtkOpenGLState.cxx:175 WARN| Error in cache state for GL_BLEND_SRC_ALPHA
2021-03-19 13:45:26.539 ( 7.829s) [ 28544180] vtkOpenGLState.cxx:182 WARN| Error in cache state for GL_BLEND_DST_RGB
2021-03-19 13:45:26.539 ( 7.829s) [ 28544180] vtkOpenGLState.cxx:189 WARN| Error in cache state for GL_BLEND_DST_ALPHA
2021-03-19 13:45:26.539 ( 7.829s) [ 28544180] vtkOpenGLState.cxx:196 WARN| Error in cache state for GL_DRAW_FRAMEBUFFER_BINDING
2021-03-19 13:45:26.539 ( 7.829s) [ 28544180] vtkOpenGLState.cxx:203 WARN| Error in cache state for GL_READ_FRAMEBUFFER_BINDING
2021-03-19 13:45:26.539 ( 7.829s) [ 28544180] vtkOpenGLState.cxx:222 WARN| Error in cache state for GL_DRAW_BUFFER got -2130540316 expected1026
2021-03-19 13:45:26.539 ( 7.829s) [ 28544180] vtkOpenGLState.cxx:240 WARN| Error in cache state for GL_READ_BUFFER
2021-03-19 13:45:26.539 ( 7.829s) [ 28544180] vtkOpenGLState.cxx:257 WARN| Error in cache state for GL_COLOR_CLEAR_VALUE
2021-03-19 13:45:26.540 ( 7.830s) [ 28544180] vtkOpenGLState.cxx:265 WARN| at stack loc
0x7f812d36bb77 : ??? [(???) ???:-1]
0x7f812d366d9c : vtksys::SystemInformation::GetProgramStack[abi:cxx11](int, int) [(libvtksys-9.0.so.1) ???:-1]
0x7f81305ed9dd : vtkOpenGLState::CheckState() [(libvtkRenderingOpenGL2-9.0.so.1) ???:-1]
0x7f81305f091a : vtkOpenGLState::vtkglViewport(int, int, int, int) [(libvtkRenderingOpenGL2-9.0.so.1) ???:-1]
0x7f813051a203 : vtkOpenGLCamera::Render(vtkRenderer*) [(libvtkRenderingOpenGL2-9.0.so.1) ???:-1]
0x7f812f9e5d2b : vtkRenderer::UpdateCamera() [(libvtkRenderingCore-9.0.so.1) ???:-1]
0x7f81305cef9d : vtkOpenGLRenderer::DeviceRender() [(libvtkRenderingOpenGL2-9.0.so.1) ???:-1]
0x7f812f9e55e8 : vtkRenderer::Render() [(libvtkRenderingCore-9.0.so.1) ???:-1]
0x562ab4b87c08 : ??? [(???) ???:-1]
0x562ab4b75e79 : ??? [(???) ???:-1]
0x562ab4b7657c : ??? [(???) ???:-1]
0x562ab4b76a8c : ??? [(???) ???:-1]
0x7f812ce2909b : __libc_start_main [(libc.so.6) ???:-1]
0x562ab4b7555a : ??? [(???) ???:-1]

Hmmm… you disabled vtkRenderingContextOpenGL2 but your trace shows calls to libvtkRenderingOpenGL2. Something doesn’t look right.

Dear Paulo,

You are right, I already tried with different configurations. It looks like it works only when I launch it from that machine with GUI. I receive errors only when I try to work from command line from remote machine. I guess it might be related to GUI usage. However I don’t want to display something, I want only write images into png file.

Hello,

When I need to run GUI programs from a text-only terminal (e.g. to run tests), I do this:

Xvnc :5 & → if this doesn’t work, try the one below
Xvfb :5 &
export DISPLAY=:5 → now GUI programs outputs to the dummy display.

I hope this helps.

cheers,

Paulo