9.0.0.rc1 ContextOpenGL2 not built

I’ve built 9.0rc1 and use 9.0rc1 to reconfigure my project. But it exists an error: “Could not find the VTK package with the following required components: RenderingContextOpenGL2.” I find that there is no cmake files in ContextOpenGL2 folder

What tarball did you download? I’m seeing it in the download here. I have an MD5 of 2d872d47e671dec466b5482f7b34e4c6.

I ran into a similar issue and had to explicitly add -DVTK_MODULE_ENABLE_VTK_RenderingContextOpenGL2=YES to my CMake line (see post here: https://discourse.vtk.org/t/two-questions-about-new-module-system).

This was unlike with VTK 8.x (which used the old module system), where the RenderingContextOpenGL2 module was brought in transitively through some dependency.

Hi Elvis, I am new to VTK - please could you help - where exactly do you add this line in the CMake file? I am currently just trying to run the Glyph3DImage example, but when I run CMake I get this error: “Skipping Glyph3DImage: Could not find the VTK package with the following required components: RenderingContextOpenGL2.” The CMake file currently looks like this:

cmake_minimum_required(VERSION 3.3 FATAL_ERROR)


find_package(VTK COMPONENTS 
  vtkRenderingOpenGL2 QUIET) 
  message("Skipping Glyph3DImage: ${VTK_NOT_FOUND_MESSAGE}")
  return ()
  # old system
  add_executable(Glyph3DImage MACOSX_BUNDLE Glyph3DImage.cxx )
  target_link_libraries(Glyph3DImage PRIVATE ${VTK_LIBRARIES})
else ()
  # include all components
  add_executable(Glyph3DImage MACOSX_BUNDLE Glyph3DImage.cxx )
  target_link_libraries(Glyph3DImage PRIVATE ${VTK_LIBRARIES})
  # vtk_module_autoinit is needed
    TARGETS Glyph3DImage
endif () 

Many thanks

Hi Jennifer, which version do you use? I haven’t tried the latest release. It’s strange if the latest vtk still has this bug. You can add an entry “VTK_MODULE_ENABLE_VTK_RenderingContextOpenGL2” in CMake-Gui when you configure your VTK (not your example). After rebuilding VTK, your example may works.

Hi Yue Jin, Thank you so much for replying. I have re-built and installed VTK again but unfortunately no joy! I used “Add Entry”. I used type “STRING” - is this correct? VTK_MODULE_ENABLE_VTK_RenderingContextOpenGL2 appears as it should in CMake:
Maybe I need to download a later development version of VTK - the one I have installed is the release on the Kitware webpage but maybe signing up to the GitHub would be the way to go?

Hi Yue Jin, I have now installed the latest version downloaded from GitLab, and the issue is the same…

Try to assign “Yes” instead of DEFAULT to this entry

Hi You Jin, Thank you so much. Yes, I finally got VTK to compile and install with this option (after I added the entry and configured the value reverted to DEFAULT, and I had to edit and configure again). Unfortunately, this newly compiled VTK now won’t actually display the render window when I run the examples (I had previously comiled and run “Sphere” and the render windo appeared with a sphere in it. Now, it seems to run (no errors), but nothing happens. I think this may be something to do with OpenGL. Have you any ideas? Did this happen when you made the edit? Maybe this should be a different thread?

when I use this flag in cmake, I get this warning:
CMake Warning:
Manually-specified variables were not used by the project:


Hm okay. I just tested with

curl -LO https://www.vtk.org/files/release/9.0/VTK-9.0.1.tar.gz
tar xf VTK-9.0.1.tar.gz
cd VTK-9.0.1/
mkdir build
cd build
cmake -DVTK_MODULE_ENABLE_VTK_RenderingContextOpenGL2=YES ..

and I’m not getting that warning here. Full transcript here: transcript.txt (30.0 KB)

Maybe it has something to with what groups/modules get enabled by default on your system. Would help to see the output from the CMake run.

1 Like