"Could not find the VTK package with the following required components: RenderingContextOpenGL2."

I am trying to run one of the examples “Glyph3DImage”, and also use vtkGlyph3DMapper in some other code. I am using the latest CMake and VTK9.0.0. The error “Could not find the VTK package with the following required components: RenderingContextOpenGL2.” occurs when I run CMake. It looks like this is to do with the way VTK9.0.0 deals with modules, but I am unsure how to solve the problem. Do I need to make changes to my VTK installation, or do I need to edit the files for the individual example, and if so, how?

Many thanks. Apologies, I think this question has been answered before, but I am unable to follow the answers to fix the problem.

There should be a VTK_NOT_FOUND_MESSAGE variable which contains the reasoning. CMake should show it automatically if you used REQUIRED. Possible causes:

  • your VTK build does not have that module available (most likely)
  • some other module it needs could not find a dependency (possible)
  • OpenGL was not found (unlikely)

Thanks. I’m using CMake with the GUI in Windows 10. I guess there is some setting that sets REQUIRED, but it’s not jumping out at me! Sorry, I’m new to CMake and VTK.

Dear Ben, I added and entry in CMake using VTK_MODULE_ENABLE_VTK_RenderingContextOpenGL2 and setting its value to YES. This now seems to mean that the examples can be created in CMake and compiled in Visual Studio but now I have a problem that I was experiencing with an older version of VTK - I run the executable and although it appears to have run (no errors), no visualization window appears (nothing happens). Do you have any ideas? All my problems seem related to OpenGL in some way? Many thanks,
Jen

You shouldn’t need to add such an entry. It might be advanced, but it should be offered automatically.

As for the window, showing the code that is executing would be useful. I suspect the window is made, but never shown and the program exits without waiting for an interaction loop to happen. Cc: @ken-martin

Yes, it all seems a little odd, especially as I’m using the most up to date versions of everything. The render window was showing for the Sphere example before I “added” RenderingContextOpenGL2, but then the Glyph3D example wouldn’t compile. It feels like something needs updating in the example code so that I am pointing to the right place, rather than making the change to the installation? Either that, or there is some kind of issue with the OpenGL on my laptop? I did also send an e-mail to the address given on the example page but unfortunately haven’t had any response.