[vtk-developers] Problem in VTK 8.2 with defaultFormat() and QVTKOpenGLWidget on Windows 10/Intel

Elvis Stansvik elvis.stansvik at orexplore.com
Tue May 21 08:55:56 EDT 2019


Den tis 21 maj 2019 kl 14:45 skrev Elvis Stansvik
<elvis.stansvik at orexplore.com>:
>
> (Sorry I forgot to post to Discourse!)

I turned it into a Discourse topic, please reply there instead:

    https://discourse.vtk.org/t/problem-in-vtk-8-2-with-defaultformat-and-qvtkopenglwidget-on-windows-10-intel/998

Elvis

>
> Den tis 21 maj 2019 kl 14:44 skrev Elvis Stansvik
> <elvis.stansvik at orexplore.com>:
> >
> > Hi all,
> >
> > I'm in the process of porting our application to VTK 8.2.0, so
> > switching to the new QVTKOpenGLWidget where possible (and staying with
> > QVTKOpenGLNativeWidget where necessary).
> >
> > I'm struggling with a problem I'm seeing on Windows 10 / Intel
> > graphics in the new QVTKOpenGLWidget.
> >
> > When we add some actors to the renderer during runtime and then call
> > Render(), the rendering seems ineffective (nothing shows up) until the
> > user resizes the widget a little (causing a second render). The
> > problem can be "worked around" of course by simply issuing two
> > successive Render() calls, but this is obviously an ugly workaround.
> >
> > The problem is not appearing on our Linux or macOS test machines, only
> > on the Windows 10 machine (Intel graphics, though not sure that
> > matters).
> >
> > I started digging around, and it seems the problem can also be "fixed"
> > by using a OpenGL compatibility profile instead of core profile (which
> > is what QVTKOpenGLWidget::defaultFormat() returns).
> >
> > So instead of
> >
> >   QSurfaceFormat::setDefaultFormat(QVTKOpenGLWidget::defaultFormat());
> >
> > if I do
> >
> >   auto format = QVTKOpenGLWidget::defaultFormat();
> >   format.setProfile(QSurfaceFormat::CompatibilityProfile);
> >   QSurfaceFormat::setDefaultFormat(format);
> >
> > that seems to "solve" the problem.
> >
> > Below is a minimal test case where I simply show a QVTKOpenGLWidget,
> > and 2 seconds later I set the renderer background to red and call
> > Render(). For me, the window will not turn red until I resize it a
> > little (or if I uncomment either of the two commented lines).
> >
> > Has anyone seen this problem before?
> >
> > I have not tested with VTK master yet, and I know there has been some
> > changes, but we would really like to stick to a released version
> > (8.2.0).
> >
> > Versions used:
> >
> > - Windows 10
> > - Intel UHD Graphics 620 (driver 24.20.100.6344)
> > - VTK 8.2.0
> > - Qt 5.12.3 (5.11.1 also tested)
> >
> > Many thanks in advance for any tips/advice.
> >
> > Elvis
> >
> > renderbug.cpp:
> >
> > #include <QApplication>
> > #include <QSurfaceFormat>
> > #include <QTimer>
> > #include <QtDebug>
> >
> > #include <QVTKOpenGLWidget.h>
> >
> > #include <vtkGenericOpenGLRenderWindow.h>
> > #include <vtkNew.h>
> > #include <vtkRenderer.h>
> >
> > int main(int argc, char *argv[])
> > {
> >     auto format = QVTKOpenGLWidget::defaultFormat();
> >     //format.setProfile(QSurfaceFormat::CompatibilityProfile);
> >     QSurfaceFormat::setDefaultFormat(format);
> >
> >     QApplication app(argc, argv);
> >
> >     vtkNew<vtkRenderer> renderer;
> >
> >     vtkNew<vtkGenericOpenGLRenderWindow> window;
> >     window->AddRenderer(renderer);
> >
> >     QVTKOpenGLWidget widget;
> >     widget.SetRenderWindow(window);
> >
> >     QTimer::singleShot(2000, [&window, &renderer]() {
> >         qDebug() << "Setting background to red and rendering";
> >         renderer->SetBackground(1.0, 0.0, 0.0);
> >         window->Render();
> >         //window->Render();
> >     });
> >
> >     widget.show();
> >
> >     return app.exec();
> > }
> >
> > CMakeLists.txt:
> >
> > cmake_minimum_required(VERSION 3.5)
> >
> > project(renderbug)
> >
> > find_package(Qt5Widgets REQUIRED)
> >
> > find_package(VTK 8.2.0 REQUIRED COMPONENTS
> >     vtkGUISupportQt
> >     vtkInteractionStyle
> >     vtkRenderingCore
> >     vtkRenderingOpenGL2
> > )
> >
> > add_executable(renderbug WIN32
> >     renderbug.cpp
> > )
> >
> > target_link_libraries(renderbug PRIVATE
> >     Qt5::Widgets
> >     vtkGUISupportQt
> >     vtkInteractionStyle
> >     vtkRenderingCore
> >     vtkRenderingOpenGL2
> > )
> >
> > target_include_directories(renderbug SYSTEM PRIVATE
> >     ${VTK_INCLUDE_DIRS}
> > )
> >
> > target_compile_definitions(renderbug PRIVATE
> >     ${VTK_DEFINITIONS}
> > )


More information about the vtk-developers mailing list