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

**URL:** https://discourse.vtk.org/t/how-to-use-vtk-to-check-if-a-discrete-gpu-existed/10977
**Category:** Support
**Created:** [March 15, 2023, 11:32am UTC](https://discourse.vtk.org/t/how-to-use-vtk-to-check-if-a-discrete-gpu-existed/10977 "2023-03-15T11:32:05Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![AlexLuya](https://discourse.vtk.org/user_avatar/discourse.vtk.org/alexluya/32/4036_2.png) [@AlexLuya](https://discourse.vtk.org/u/AlexLuya)
#### Post date: [March 15, 2023, 11:32am UTC](https://discourse.vtk.org/t/how-to-use-vtk-to-check-if-a-discrete-gpu-existed/10977/1 "2023-03-15T11:32:05Z")

</div>

Hello,ChatGPT gives me this:

```auto
#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?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [March 15, 2023, 12:30pm UTC](https://discourse.vtk.org/t/how-to-use-vtk-to-check-if-a-discrete-gpu-existed/10977/2 "2023-03-15T12:30:09Z")

</div>

> [@AlexLuya](#):
>
> Hello,ChatGPT gives me this:

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.

---

<div class="post-metadata">

### Author: ![rexthor](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rexthor/32/6481_2.png) [@rexthor](https://discourse.vtk.org/u/rexthor)
#### Post date: [March 15, 2023, 1:37pm UTC](https://discourse.vtk.org/t/how-to-use-vtk-to-check-if-a-discrete-gpu-existed/10977/3 "2023-03-15T13:37:21Z")

</div>

My usual crutch is Stack Overflow, you may have to use [something like this](https://stackoverflow.com/questions/29331253/how-can-i-get-gpu-information).

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [March 15, 2023, 9:05pm UTC](https://discourse.vtk.org/t/how-to-use-vtk-to-check-if-a-discrete-gpu-existed/10977/4 "2023-03-15T21:05:19Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Hedwig\_Huang](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hedwig_huang/32/7745_2.png) [@Hedwig\_Huang](https://discourse.vtk.org/u/Hedwig_Huang)
#### Post date: [November 22, 2023, 1:20am UTC](https://discourse.vtk.org/t/how-to-use-vtk-to-check-if-a-discrete-gpu-existed/10977/6 "2023-11-22T01:20:34Z")

</div>

hi there, but how can I know that if VTK is using a GPU for rendering or sth? My mates told me that the GPU drive is limited by VTK version. But it seems make no sense? I have no idea. Thanks a lot.

---

<div class="post-metadata">

### Author: ![Hedwig\_Huang](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hedwig_huang/32/7745_2.png) [@Hedwig\_Huang](https://discourse.vtk.org/u/Hedwig_Huang)
#### Post date: [November 24, 2023, 8:27am UTC](https://discourse.vtk.org/t/how-to-use-vtk-to-check-if-a-discrete-gpu-existed/10977/7 "2023-11-24T08:27:42Z")

</div>

It seems that some OpenGL version is needed for vtk. Because the higher version of vtk8.2 seems dumped the old version OpenGL1 in the earlier 8.1 version. After change the vtk version from 8.0 to 8.2, things go wrong.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [November 26, 2023, 3:31am UTC](https://discourse.vtk.org/t/how-to-use-vtk-to-check-if-a-discrete-gpu-existed/10977/8 "2023-11-26T03:31:03Z")

</div>

Probably the minimum required OpenGL version was increased in VTK 8.2. Supporting an older OpenGL version means that you cannot take advantage of modern graphics hardware and software improvements, which makes VTK slower on modern hardware and makes VTK maintenance and development harder. Since OpenGL 1 was superseded by OpenGL 2 in 2004 it was really time fro VTK to drop OpenGL support in VTK 8.2 in 2019.

Note that OpenGL 1 is so old that if your computer seems to offer only this OpenGL version then it almost surely means that there is a configuration error. For example, you are using Windows Remote Desktop Protocol and due to a misconfigured server or incompatible client you get a legacy OpenGL 1.1 context. You should be able to fix this issue or (if you don’t have graphics hardware) then you can use a software renderer (that performs all OpenGL operations on the CPU).

---

<div class="post-metadata">

### Author: ![Hedwig\_Huang](https://discourse.vtk.org/user_avatar/discourse.vtk.org/hedwig_huang/32/7745_2.png) [@Hedwig\_Huang](https://discourse.vtk.org/u/Hedwig_Huang)
#### Post date: [November 27, 2023, 1:06am UTC](https://discourse.vtk.org/t/how-to-use-vtk-to-check-if-a-discrete-gpu-existed/10977/9 "2023-11-27T01:06:03Z")

</div>

Thanks for replying! So you mean that OpenGL is not necessary for VTK8.2, but the limited version of OpenGL is still working. In [vtk8.1UpdateNote](https://www.kitware.com/vtk-8-1-0/) and [vtk8.2UpdateNote](https://www.kitware.com/vtk-8-2-0/) from @DavidDeMarle just mention OpenGL1 dropped. So I wondered if the driver of my GPU is not work for VTK, is it because the GPU is too old. 🥲
