VTK for QT

When I used vtk in qt, there was an error like this.

Generic Warning: In vtkOpenGLState.cxx, line 57
Error in cache state for GL_DEPTH_WRITEMASK

Generic Warning: In vtkOpenGLState.cxx, line 263
at stack loc
 at vtksys::SystemInformationImplementation::GetProgramStack in D:\download\vtk\VTK-9.3.1\Utilities\KWSys\vtksys\SystemInformation.cxx line 3987
 at vtksys::SystemInformation::GetProgramStack in D:\download\vtk\VTK-9.3.1\Utilities\KWSys\vtksys\SystemInformation.cxx line 829
 at vtkOpenGLState::CheckState in D:\download\vtk\VTK-9.3.1\Rendering\OpenGL2\vtkOpenGLState.cxx line 262
 at vtkOpenGLState::vtkglViewport in D:\download\vtk\VTK-9.3.1\Rendering\OpenGL2\vtkOpenGLState.cxx line 929
 at vtkOpenGLCamera::Render in D:\download\vtk\VTK-9.3.1\Rendering\OpenGL2\vtkOpenGLCamera.cxx line 51
 at vtkRenderer::UpdateCamera in D:\download\vtk\VTK-9.3.1\Rendering\Core\vtkRenderer.cxx line 481
 at vtkOpenGLRenderer::DeviceRender in D:\download\vtk\VTK-9.3.1\Rendering\OpenGL2\vtkOpenGLRenderer.cxx line 288
 at vtkRenderer::Render in D:\download\vtk\VTK-9.3.1\Rendering\Core\vtkRenderer.cxx line 374
 at vtkRendererCollection::Render in D:\download\vtk\VTK-9.3.1\Rendering\Core\vtkRendererCollection.cxx line 40
 at pcl::visualization::PCLVisualizer::addModelFromPLYFile
 at vtkInteractorStyle::ProcessEvents in D:\download\vtk\VTK-9.3.1\Rendering\Core\vtkInteractorStyle.cxx line 1074
 at vtkCallbackCommand::Execute in D:\download\vtk\VTK-9.3.1\Common\Core\vtkCallbackCommand.cxx line 30
 at vtkSubjectHelper::InvokeEvent in D:\download\vtk\VTK-9.3.1\Common\Core\vtkObject.cxx line 592
 at vtkObject::InvokeEvent in D:\download\vtk\VTK-9.3.1\Common\Core\vtkObject.cxx line 807
 at QVTKInteractor::TimerEvent in D:\download\vtk\VTK-9.3.1\GUISupport\Qt\QVTKInteractor.cxx line 198
 at QVTKInteractorInternal::TimerEvent in D:\download\vtk\VTK-9.3.1\GUISupport\Qt\QVTKInteractor.cxx line 57
 at QtPrivate::FunctorCall<QtPrivate::IndexesList<0>,QtPrivate::List<int>,void,void (__cdecl QVTKInteractorInternal::*)(int)>::call in D:\App\tools\Qt\6.7.3\msvc2022_64\include\QtCore\qobjectdefs_impl.h line 145
 at QtPrivate::FunctionPointer<void (__cdecl QVTKInteractorInternal::*)(int)>::call<QtPrivate::List<int>,void> in D:\App\tools\Qt\6.7.3\msvc2022_64\include\QtCore\qobjectdefs_impl.h line 182
 at QtPrivate::QCallableObject<void (__cdecl QVTKInteractorInternal::*)(int),QtPrivate::List<int>,void>::impl in D:\App\tools\Qt\6.7.3\msvc2022_64\include\QtCore\qobjectdefs_impl.h line 553
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QLineEdit::`default constructor closure'
 at QLineEdit::`default constructor closure'
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QLineEdit::`default constructor closure'
 at QLineEdit::`default constructor closure'
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QTextCharFormat::setFontLetterSpacingType
 at QFileInfo::filePath
 at QTextCharFormat::setFontLetterSpacingType
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QFileInfo::filePath
 at QTextCharFormat::setFontLetterSpacingType
 at QLineEdit::`default constructor closure'
 at main in D:\Study\Qt\PCL_dao\main.cpp line 23
 at qtEntryPoint in C:\Users\qt\work\qt\qtbase\src\entrypoint\qtentrypoint_win.cpp line 45
 at WinMain in C:\Users\qt\work\qt\qtbase\src\entrypoint\qtentrypoint_win.cpp line 64
 at invoke_main in D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl line 107
 at __scrt_common_main_seh in D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl line 288
 at __scrt_common_main in D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl line 331
 at WinMainCRTStartup in D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_winmain.cpp line 17
 at BaseThreadInitThunk
 at RtlUserThreadStart

Meanwhile, the FPS is 0. How can I solve it?

Hello,

Can you, please, share the part of the code that is abend-ing?

best,

PC

This is my code which I use in Qt.

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    sourceCloud = new CloudSet;
    targetCloud = new CloudSet;

    QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());

    vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
    vtkSmartPointer<vtkGenericOpenGLRenderWindow> renderWindow = vtkSmartPointer<vtkGenericOpenGLRenderWindow>::New();
    renderWindow->AddRenderer(renderer);
    viewer.reset(new pcl::visualization::PCLVisualizer(renderer, renderWindow, "viewer", false));
    ui->openGLWidget->setRenderWindow(renderWindow);
    viewer->setupInteractor(ui->openGLWidget->interactor(), renderWindow);
    viewer->resetCamera();
    ui->openGLWidget->update();
}

Hello,

What class does ui->openGLWidget belong to?

best,

PC