How to use vtk to check if a discrete GPU existed?

Hello,ChatGPT gives me this:

#include <iostream>
#include <vtkRenderWindow.h>

bool isDiscreteGPUExist()
{
    vtkSmartPointer<vtkRenderWindow> window = vtkSmartPointer<vtkRenderWindow>::New();
    window->OffScreenRenderingOn();
    window->SetMultiSamples(0);
    window->SetNumberOfLayers(1);
    window->SetSize(1, 1);
    window->OffScreenRenderingOff();
    window->MakeCurrent();
    bool success = window->IsCurrent();
    window->Finalize();
    return success;
}

int main()
{
    if (isDiscreteGPUExist())  {
        std::cout << "Discrete GPU exists!\n";
    }  else  {
        std::cout << "No discrete GPU found!\n";
    }
    return 0;
}

It seems not right,I do have a discrete GPU,but got:

“No discrete GPU found!”

Is there any way to do this checking?

Please write your own code.

How to use vtk to check if a discrete GPU

I dont think VTK can do that. You can recover OpenGL information.

My usual crutch is Stack Overflow, you may have to use something like this.

The operating system and GPU APIs make a lot of effort to hide exactly this kind of low-level information from applications. It just should not matter.

What you may need to know if a certain version of some API (CUDA, OpenGL,…) is supported.