Get the graphics card model?

♀尐吖头ヾ 提交于 2019-11-26 22:01:37

问题


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


回答1:


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.




回答2:


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"



回答3:


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




回答4:


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




回答5:


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)



来源:https://stackoverflow.com/questions/1090261/get-the-graphics-card-model

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!