From pbergeron at spiria.com Wed May 8 16:51:29 2019 From: pbergeron at spiria.com (Patrick Bergeron) Date: Wed, 8 May 2019 20:51:29 +0000 Subject: [vtk-developers] Compiling VTK with ANGLE Message-ID: Hey folks, I am trying to compile VTK with ANGLE on Windows. (for those who don't know, ANGLE is a GLESv2 and GLESv3 front-end over DirectX). And I am using VTK in a Qt app. Since Qt already ships with ANGLE (dll, import library, headers, everything I need), I am trying to use this library (libglesv2.lib) instead of the native opengl32.lib, which loads the native OpenGL driver DLL. However, I am hitting problems everywhere. Doing research on the topic, it appears that someone successfully managed - sort of - to get this going in 2017. https://vtk.org/pipermail/vtk-developers/2017-July/035304.html Alas, the suggested patch file to the cmake files no longer seems relevant. Also, as as late, there seems to be new difficulties with doing this, although the post below is with Linux. https://gitlab.kitware.com/vtk/vtk/issues/17584 Has anyone successfully done this before? Here are my cmake settings: OPENGL_gl_LIBRARY=libGLESv2 OPENGL_opengl_LIBRARY=libGLESv2 (added variable) OPENGL_gles3_LIBRARY=libGLESv2 (added variable) OPENGL_GLES3_INCLUDE_DIR=C:\Qt\Qt5.11.0\5.11.0\msvc2015_64\include\QtANGLE (added variable) VTK_OPENGL_USE_GLES=[CHECKED] Qt5OpenGL_DIR=C:/Qt/Qt5.11.0/5.11.0/msvc2015_64/lib/cmake/Qt5OpenGL VTK_GROUP_ENABLE_Qt=YES VTK_GROUP_ENABLE_VTK_RenderingQt=YES Thanks everyone! -------------- next part -------------- An HTML attachment was scrubbed... URL: From elvis.stansvik at orexplore.com Tue May 21 08:44:06 2019 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Tue, 21 May 2019 14:44:06 +0200 Subject: [vtk-developers] Problem in VTK 8.2 with defaultFormat() and QVTKOpenGLWidget on Windows 10/Intel Message-ID: 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 #include #include #include #include #include #include #include int main(int argc, char *argv[]) { auto format = QVTKOpenGLWidget::defaultFormat(); //format.setProfile(QSurfaceFormat::CompatibilityProfile); QSurfaceFormat::setDefaultFormat(format); QApplication app(argc, argv); vtkNew renderer; vtkNew 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} ) From elvis.stansvik at orexplore.com Tue May 21 08:45:20 2019 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Tue, 21 May 2019 14:45:20 +0200 Subject: [vtk-developers] Problem in VTK 8.2 with defaultFormat() and QVTKOpenGLWidget on Windows 10/Intel In-Reply-To: References: Message-ID: (Sorry I forgot to post to Discourse!) Den tis 21 maj 2019 kl 14:44 skrev Elvis Stansvik : > > 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 > #include > #include > #include > > #include > > #include > #include > #include > > int main(int argc, char *argv[]) > { > auto format = QVTKOpenGLWidget::defaultFormat(); > //format.setProfile(QSurfaceFormat::CompatibilityProfile); > QSurfaceFormat::setDefaultFormat(format); > > QApplication app(argc, argv); > > vtkNew renderer; > > vtkNew 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} > ) From elvis.stansvik at orexplore.com Tue May 21 08:55:56 2019 From: elvis.stansvik at orexplore.com (Elvis Stansvik) Date: Tue, 21 May 2019 14:55:56 +0200 Subject: [vtk-developers] Problem in VTK 8.2 with defaultFormat() and QVTKOpenGLWidget on Windows 10/Intel In-Reply-To: References: Message-ID: Den tis 21 maj 2019 kl 14:45 skrev Elvis Stansvik : > > (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 > : > > > > 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 > > #include > > #include > > #include > > > > #include > > > > #include > > #include > > #include > > > > int main(int argc, char *argv[]) > > { > > auto format = QVTKOpenGLWidget::defaultFormat(); > > //format.setProfile(QSurfaceFormat::CompatibilityProfile); > > QSurfaceFormat::setDefaultFormat(format); > > > > QApplication app(argc, argv); > > > > vtkNew renderer; > > > > vtkNew 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} > > )