QVTKOpenGLWidget: GPU volume rendering gives OpenGL error
When using QVTKOpenGLWidget, GPU volume rendering gives an OpenGL error if multisampling is enabled:
ERROR: In C:\path\to\VTK\Rendering\OpenGL2\vtkTextureObject.cxx, line 2149
vtkTextureObject (0000025F62476940): failed at glCopyTexImage2D 6402 1 OpenGL errors detected
0 : (1282) Invalid operation
vtkOpenGLRenderWindow::GetGlobalMaximumNumberOfMultiSamples() controls the multisampling factor. Except on Mac, this defaults to 8: https://gitlab.kitware.com/vtk/vtk/blob/c5185feb05be0cc9882c25a7dabc7558c5b9db7d/Rendering/OpenGL2/vtkOpenGLRenderWindow.cxx#L61
See attached example project that configures QVTKOpenGLWidget like this:
QSurfaceFormat::setDefaultFormat(QVTKOpenGLWidget::defaultFormat());
// Default format has vtkOpenGLRenderWindow::GetGlobalMaximumNumberOfMultiSamples() samples
QApplication app(argc, argv);
auto renWin = vtkSmartPointer<vtkGenericOpenGLRenderWindow>::New();
QVTKOpenGLWidget widget;
widget.SetRenderWindow(renWin.Get());