如何在DirectX中检索纹理信息?

时间:2014-06-16 21:30:18

标签: directx

如何检索纹理宽度,高度,已在DirectX中创建的纹理的mipmap级别数?它的API是什么?

1 个答案:

答案 0 :(得分:0)

使用ID3D10Texture2D::GetDesc,假设pTexture是指向ID3D10Texture2D的有效指针,那么

D3D10_TEXTURE2D_DESC texDesc;
pTexture->GetDesc(&texDesc);

以下是您可以从texDesc获得的信息

typedef struct D3D10_TEXTURE2D_DESC {
  UINT             Width;
  UINT             Height;
  UINT             MipLevels;
  UINT             ArraySize;
  DXGI_FORMAT      Format;
  DXGI_SAMPLE_DESC SampleDesc;
  D3D10_USAGE      Usage;
  UINT             BindFlags;
  UINT             CPUAccessFlags;
  UINT             MiscFlags;
} D3D10_TEXTURE2D_DESC;