Having a first look at porting our application to VTK 9.0.0.
First question is about vtkRenderingContextOpenGL2. With 9.0.0 it seems we no longer get that library? What should I link against to pick the OpenGL2 backend for context views? Or has the library been removed and they are now using OpenGL2 by default?
Second question: CMake of our project finishes successfully, but VTK_INCLUDE_DIRS is now empty. I’m guessing this has to do with the VTK CMake changes/new module system? How do I get the VTK include directories added nowadays? I looked at @ben.boeckel’s post at https://vtk.org/pipermail/vtk-developers/2019-January/036648.html under the “For consumers of VTK” section but couldn’t find any info about changes in how to consume VTK include directories.
For object factories to work, vtk_module_autoinit should be used.
This generates the proper -D flags for getting initialization to
work.
Will the CMake machinery still add automatic compile flags like -DvtkRenderingContext2D_AUTOINIT="1(vtkRenderingContextOpenGL2)", or must I do something manually with vtk_module_autoinit myself?
Nevermind this question, I see I sort of already asked it back in Bill’s ML thread “vtk_module_autoinit in new module system” ([vtk-developers] vtk_module_autoinit in new module system). So I will have to make a call to that function.
I should have done some more digging. I got everything working by 1) Adding the vtk_module_autoinit calls for our targets. 2) Fixing to use VTK::Foo instead of vtkFoo in some places.
Or well, I still have uses of deprecated stuff to take care of, but at least now the compile/link lines are all good
First question is about vtkRenderingContextOpenGL2 . With 9.0.0 it seems we no longer get that library? What should I link against to pick the OpenGL2 backend for context views? Or has the library been removed and they are now using OpenGL2 by default?
Hm, now that I got the program built, it crashes at runtime with:
2020-03-22 11:51:44.120 ( 0,477s) [ F002EC40] vtkContextDevice2D.cxx:32 WARN| Error: no override found for 'vtkContextDevice2D'.
So I’m guessing there’s something missing after all. In VTK 8 I could link against vtkRenderingContextOpenGL2 to pick an implementation. What should I link against in VTK 9?
Thanks a lot for all the answers. Makes perfect sense.
I must have gotten the RenderingContextOpenGL2 by “luck” in my earlier VTK 8 build due to some dependency.
Since RenderingContextOpenGL2, unlike e.g. RenderingVolumeOpenGL2, is not part of the Rendering group (should it be?), I guess I must enable that module explicitly to get it?
So there seems to have been a mechanism that brought in all these *OpenGL2 modules in one go according to the chosen backend. I did not specify the OpenGL2 backend in that CMake run explicitly (I.e. did not pass -DVTK_RENDERING_BACKEND), so it was picked by default.
In VTK 9, with the old OpenGL backend gone (right?), should not (for example) RenderingContext depend on RenderingContextOpenGL2, because it won’t function without it?
Looking at the old module.cmake file, it was never part of the Rendering group. It was probably dragged in by IMPLEMENTATION_REQUIRED_BY_BACKEND (your newest reply seems to confirm that) which is…hairy logic to say the least. It’s tough to say what should be done here because the logic to implement that flag would be extremely difficult to get right.
That’s gone now. Hopefully, the Vulkan backend will be a runtime selection, not a compile-time selection thing.
Alright thanks. I’ll pretend the hairy IMPLEMENTATION_REQUIRED_BY_BACKEND never existed and enable the module explicitly I wonder though why RenderingVolumeOpenGL2 is part of the Rendering group while RenderingContextOpenGL2 is not.
I think I’m asking about something similar so I don’t create new topic.
With VTK 9.0 and Qt I cannot launch 2D examples from VTK web-site.
Previously with VTK 8.2 I used to add few lines in my code from mailing list:
Yes I read these abstracts from the link few times but I can’t say that I understand what it is about. For now I don’t fully understand the problem and the solution as well. I don’t have enough knowledge yet to understand it.
I would very appreciate if you give something like copy-past example how to launch any of 2D VTK example, maybe this one
By the way is it ok that I don’t have vtkRenderingContextOpenGL2-9.0.lib in VTK 9.0 or I should recompile the VTK library?
It’s only a problem if you want to use a class that has an implementation in that module. Since you’re asking, the answer is probably “yes” though . You’ll need to recompile VTK for that.
What you can do is make a small CMake project which links to what you’re linking to, use vtk_module_autoinit, and see what the header it ends up generating is. You can put that at the top of whatever file(s) you need it in then.
I just reopened VTK in CMake-GUI and I found that module (in the picture).
I have a feeling that I should postpone the recompilation because there is many “interesting-labeled” modules so this is going to be not the last recompilation
Thank you for advices, I hope everything is going to work well.