Our application gives opengl errors when making offscreen images of the QVTKNativeWidget.
Saving images uses a second offscreen render window, because we want the image to have a different screen size than the widget’s window. The offscreen window duplicates all actors etc. from the QVTKNativeWidget’s render window, taking care to not share the graphics resources. After rendering the offscreen window the vtkWindowToImage filter generates the image which is saved to png.
This works well with VTK 8.1.1. With VTK 9.1 I observe OpenGL errors as reproduced below. The
application crashes reproducibly in vtkWindowToImage::RequestData while deleting the pixels array, but this depends on the specified image size!
I don’t know how to interpret these error or what to do about it and would appreciate any suggestions for further analysis or solution of this issue.
2022-02-22 18:00:40.582 ( 39.005s) [ CFBD8D00] vtkOpenGLState.cxx:83 WARN| Error in cache state for GL_BLEND
2022-02-22 18:00:40.582 ( 39.005s) [ CFBD8D00] vtkOpenGLState.cxx:90 WARN| Error in cache state for GL_DEPTH_TEST
2022-02-22 18:00:40.582 ( 39.005s) [ CFBD8D00] vtkOpenGLState.cxx:113 WARN| Error in cache state for GL_SCISSOR_TEST
2022-02-22 18:00:40.582 ( 39.005s) [ CFBD8D00] vtkOpenGLState.cxx:144 WARN| Error in cache state for GL_VIEWPORT
2022-02-22 18:00:40.582 ( 39.005s) [ CFBD8D00] vtkOpenGLState.cxx:152 WARN| Error in cache state for GL_SCISSOR_BOX
2022-02-22 18:00:40.582 ( 39.005s) [ CFBD8D00] vtkOpenGLState.cxx:173 WARN| Error in cache state for GL_DEPTH_FUNC
2022-02-22 18:00:40.582 ( 39.005s) [ CFBD8D00] vtkOpenGLState.cxx:180 WARN| Error in cache state for GL_BLEND_SRC_RGB
2022-02-22 18:00:40.582 ( 39.005s) [ CFBD8D00] vtkOpenGLState.cxx:208 WARN| Error in cache state for GL_DRAW_FRAMEBUFFER_BINDING
2022-02-22 18:00:40.710 ( 39.133s) [ CFBD8D00] vtkOpenGLState.cxx:274 WARN| at stack loc
0x7f8e9846b183 : ??? [(???) ???:-1]
0x7f8e9846975a : vtksys::SystemInformation::GetProgramStack[abi:cxx11](int, int) [(libvtksys-9.1.so.1) ???:-1]
0x7f8ea7ecd892 : vtkOpenGLState::CheckState() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0x7f8ea7ec5637 : vtkOpenGLState::SetEnumState(unsigned int, bool) [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0x7f8ea7ebfbf9 : vtkOpenGLState::vtkglEnable(unsigned int) [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0x7f8ea7e73be4 : vtkOpenGLRenderWindow::Start() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0x7f8ea7fd5ecc : vtkXOpenGLRenderWindow::Start() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0x7f8ea0c9efbb : vtkRenderWindow::Render() [(libvtkRenderingCore-9.1.so.1) ???:-1]
0x7f8ea7e7bf12 : vtkOpenGLRenderWindow::Render() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0x7f8ea7fdcea0 : vtkXOpenGLRenderWindow::Render() [(libvtkRenderingOpenGL2-9.1.so.1) ???:-1]
0x7f8ecb810e58 : RenderWindowToImage::renderImage() [(libPpfModel.so) ???:-1]
....