VTK C++ application and Visual Studio

If you study the testing dashboard, you will see several windows builds. Clicking on one of these build results (e.g., here) you can see that the compiler used is “The CXX compiler identification is MSVC 19.35.32217.1”

There are folks here that are much better than I am at the complexities of the build process. Given that disclaimer :-), based on your ability to compile / link without warnings and then produce a blank screen on execution, I’d be suspicious of your driver / and or graphics build environment.

Can you add this header to your cylinder example as well?
include <vtkAutoInit.h>

This is rendering issue related to graphic card. I had similar issue before (black rendering window) and this header solved it for me. Let me know the result

Is that the C++ compiler used by CMake?

I am confused as CMake asks me to specify the project generator which I choose to be Visual Studio 17 2022 for platform X64
I build the executable following the procedure outlined for every C++ VTK example. Then in Visual Studio I check the C++ language Standard. It shows me ISO C++ 14. Is this the same as "MSVC 19.35.32217.1”?
I suspect it is not. If my suspicion is correct then CMAke does not communicate to Visual Studio the compiler release it used.
According to my understanding/misunderstanding, if I create the executable as described on the C++ VTK examples then CMake uses a generator called “CMAKE_NINJA”.
MicroSoft team in charge of Visual Studio Community follows a different route to generate the executable
described on https://learn.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=msvc-170

This way Visual Studio generates the cmake-cache which can be edited. Microsoft staff instructed me to edit the variable “CMake Generator”. There is a dropdown menu that allows several choices. One of the choices is “Ninja”. But MicroSoft staff instructed me to pick “Visual Studio 17 2022 Win64”. Then I Save All. Then I click Project-> Delete cache and Reconfigure
The end result is the same.
I do not know if that is at all useful

I added the include file.
I used CMake and the Visual Studio as usual.
Unluckily I am still getting a black panel.

I talked to the local IT.
They would like to know the specifications of a graphic card that (you know for sure) supports VTK rendering and all what it does.

I would greatly appreciate your expert suggestions.
Thank you in advance

Well, the difficulty of your situation is that unfortunately rendering issues are complex. Hopefully your IT people fix the potential issue, meanwhile you can check if there is an issue with your graphic driver or not. Are you familiar with Paraview? At the core, Paraview is a VTK. Install it and try to open a 3d geometry with it. If everything goes well, then your problem is Not a driver

I downloaded Paraview.
I tried an example in the VTK folder.
It displays it

Does this test exclude the graphic card on my PC?

Shall I reinstall VTK for C++ with Visual Studio? If the answer is “yes” then I would appreciate some guidelines.
I installed VTK for C++ following the procedure outlined on
https://gitlab.kitware.com/vtk/vtk/-/blob/master/Documentation/dev/build_windows_vs.md

Is this a reliable VTK installation process? Can you advise another method?
Thank you for all your help and patience

It excludes driver issue, and I still believe the problem is rendering, not installation. vtk has some OpenGL graphic options which can be invoked via macros, or cmake file. I never used vtk 9, and I’m positive that those setting differ from vtk 8 that I’m using. Hopefully one of more experienced members of this community respond to you.

Regarding your question about building vtk from source, the link you followed is the standard of windows. You can also build it using gnu make, but it won’t fix the problem. Things in windows are sometimes strange, for example running exe file as administrator might fix some rendering problems. You can try that one. It also helps to check Paraview github and see how they set OpenGL setting. It might be a headache to dive into the Paraview source code, but it worths a lot.

Edit : Upon seeing the image you provided, the rendering looks very wrong. Half of the object is invisible. This might be a OpenGL driver problem. I’m not familiar with windows OpenGL drivers, so take it with a big spoon of salt, but updating your OpenGL driver might fix it. Ask your IT department.

Since I noticed a different behaviour between running VTK examples remotely from home and running the same examples on-site, I called IT assistance.
They could connect to the PC on my desk at work and change something.
Consequently, instead of getting a black panel, I got some VTK errors that hopefully will shed light on my problem.

Please, have a look at the attached screenshot. It shows VTK errors.
Is there a workaround?
Thank you.

This is OpenGL problem, but please remember running vtk remotely may introduce new error to your problems, including the ones you are having now (new ones ).

What’s your graphic card? Does it support open Gl 2? When you build your vtk, you didn’t change OpenGL options provided by cmake?

Do things work correctly when you are running directly on your computer (i.e., not via a Remote Desktop or other remote session)?

I did not change any CMake option.
I have called the department to tell me the specification of the graphic card.
Today I am working from home.

I tried to run another VTK example and again got VTK errors that I am uploading.

I will reply with the graphic card specs as soon as I know.
Thank you

Unluckily at work, I get a black panel where instead I should see the geometric shape I picked

Is there a way o WIndows 10 to compile and build a C++ code that uses VTK without resorting to CMake and without Visual Studio?

That would be a decisive test. If the executable works it would indicate that the problem lies in CMake or Visual Studio Settings.
If the excutable does not works then it would suggest that the problem lies with the graphic card.

I received the specifications of the graphics card that I am copying and pasting in the following:

The link below shows the technical specs for the graphics card which is in the Migs work pc. (ATI)

https://technical.city/en/video/FirePro-V5800#characteristics

its 2010 graphics card with PCI express interface.

https://technical.city/en/video/FirePro-V5800#characteristics

ATI FirePro V5800

2010 is way too old for vtk 9. You should think about vtk 7 or even older.

Regarding building vtk, yes as I told you before you can do it with gnu make. But it will not fix the issue since your vtk works (I made a simple example and it was OK, do you remember? ) , as long as you don’t render. So it’s graphic issue.

Thank you.
I will ask for a new graphics card.
Can you advise the brand name and the model or some critical features that are essential for VTK to work?
Regards

I’m not familiar with the hardware requirements that much, as far as I remember (don’t quote me on this) VTK 9 requires OpenGl 2.2 or 2.1. I’ve been an NVIDIA user since early 2000, so I don’t know which graphic card works better with vtk. NVIDIA seems okay with what I do. There is an option to build vtk with old OpenGl, you need to find it in your CMake GUI, and I’ve never used it.
Instead of buying a new graphics card right away, try installing vtk 7, or 8 with OpenGL 1 support. VTK 9 has performance improvement and some new capabilities, but you might not need it now. Get familiar with the vtk environment, then decide to buy a GPU to e.g. improve your performance.

I just started to use CMake for my current project with VTK.
I found only one parameter that refers to the GL (Please, see attached picture)

If I install VTK 7 will it automatically install openGl 1 ?

If I was working with Linux or Unix I would know how to dig in the file system and find if and where libraries are installed.
Unluckily I have to work with WIndows.
I installed Visual Studio and configured it for C++. It automatically installed the standard C++ compiler. I cannot find where C++ has been installed. I looked in Program File and Program File (86) but…

Yes, this parameter is the OpenGl parameter. If your GPU supports OpenGl2, you can see the OpenGl2 option in the list. For vtk 7, there will be OpenGl (without 1). I was browsing vtk libraries to find a solution for your OpenGl issue. I found this link. https://vtk.org/doc/nightly/html/vtkTestOpenGLVersion_8h.html#a863adbac1bada4e7b1e08dce13170631

I’ve never used this header, and I have no idea how to call the function HandleOpenGL32Issues(). This is going to fix your vtk9 problem. I recommend you open a new topic with a title such as “How to use HandleOpenGL32Issues function” and explain that you have opengl32, and you can’t render anything so you want to fix it by using HandleOpenGL32Issues(). I never experienced such an issue before, so I can’t help you fix it.

Alternatively, you can install vtk 7, just like your vtk9, and run an example. Just a heads-up, Cmake files of vtk 7 and 8 are a bit different than vtk9, specifically the part after find_package(), which in vtk7 is like this:

find_package(VTK REQUIRED)
vtk_module_config(VTK
  vtkCommonCore
  vtkFiltersSources
  vtkInteractionStyle
 # Whatever else module you want to include here
  vtkRendering${VTK_RENDERING_BACKEND}
)

And Also Remember to check if your Cmake picks the vtk7, not vtk 9! This link is for a simple vtk7 tutorial. The version 7 interface is old and different from the newer version, but you’ll get familiar with the data pipelines.

https://gitlab.kitware.com/vtk/vtk/-/tree/v7.0.0/Examples/Tutorial/Step1/Cxx