Get the graphics card model?
Asked Answered
P

5

12

I was wondering how I can get the graphics card model/brand from code particularly from DirectX 9.0c (from within C++ code).

Pluralize answered 7/7, 2009 at 3:38 Comment(0)
E
7

At runtime, you can query the device model and vendor:

  • In OpenGL, use the command glGetString(GL_VENDOR) or GL_RENDERER or GL_VERSION to get the information you're after.

  • In DirectX 9, it appears the info is in the Microsoft config system, and is queried from the device database. It's section 3 of this document, which also has example code: http://msdn.microsoft.com/en-us/library/bb204848(VS.85).aspx Using the same system you can get such information as the amount of ram the video card has, the driver number, etc.

Electrometallurgy answered 7/7, 2009 at 3:59 Comment(0)
T
11

The easiest way in DirectX is through IDirect3D9::GetAdapterIdentifier.

Just create a D3DADAPTER_IDENTIFIER9 object, pass a pointer to it to GetAdapterIdentifier. DirectX fills out the graphics card description as a string in the Description field. It also includes information on which display device the card is, and what driver version you have.

You get something like this:

  • Description: "NVIDIA GeForce GTX 570"
  • Device: "\.\DISPLAY1"
  • Driver: "nvd3dum.dll"
Twicetold answered 3/4, 2012 at 21:19 Comment(2)
Thanks got the information I needed and was very useful not sure why this isn't the accepted answer.Donau
... because it's three years later. :)Electrometallurgy
E
7

At runtime, you can query the device model and vendor:

  • In OpenGL, use the command glGetString(GL_VENDOR) or GL_RENDERER or GL_VERSION to get the information you're after.

  • In DirectX 9, it appears the info is in the Microsoft config system, and is queried from the device database. It's section 3 of this document, which also has example code: http://msdn.microsoft.com/en-us/library/bb204848(VS.85).aspx Using the same system you can get such information as the amount of ram the video card has, the driver number, etc.

Electrometallurgy answered 7/7, 2009 at 3:59 Comment(0)
D
2

Take a look at Chapter 2. Direct3D from my book The Direct3D Graphics Pipeline. See section 2.12, Identifying a Particular Device.

Diamagnetic answered 19/7, 2009 at 16:16 Comment(0)
O
0

You can use "DirecX Diagnostic Tool" API, like in sample DxDiagOutput from DX SDK http://msdn.microsoft.com/en-us/library/ee416986%28v=VS.85%29.aspx

Our answered 24/1, 2011 at 17:25 Comment(0)
F
0
IDirect3D9* d3dobject = Direct3DCreate9(D3D_SDK_VERSION);
D3DPRESENT_PARAMETERS d3dpresent;
memset(&d3dpresent, 0, sizeof(D3DPRESENT_PARAMETERS));
d3dpresent.Windowed = TRUE;
d3dpresent.SwapEffect = D3DSWAPEFFECT_DISCARD;
UINT adaptercount = d3dobject->GetAdapterCount();
D3DADAPTER_IDENTIFIER9* adapters = (D3DADAPTER_IDENTIFIER9*)malloc(sizeof(D3DADAPTER_IDENTIFIER9) * adaptercount);

for (int i = 0; i < adaptercount; i++)
{
      d3dobject->GetAdapterIdentifier(i, 0, &(adapters[i]));
}

Then get the description of adapters (adapters->Description)

Fleeting answered 18/6, 2018 at 21:35 Comment(1)
You don't need D3DPRESENT_PARAMETERS here. It's used for device creation in D3D9. Adapter info is available without it.Fatalism

© 2022 - 2024 — McMap. All rights reserved.