读书人

GetAdapterModeCount返回0的原因?解决

发布时间: 2012-02-21 16:26:23 作者: rapoo

GetAdapterModeCount返回0的原因??

C/C++ code
    D3DDISPLAYMODE d3ddm;    bool bDesireAdapterModeFound = false;    int nMaxAdapterModes = g_pD3D->GetAdapterModeCount(D3DADAPTER_DEFAULT, D3DFMT_X4R4G4B4);         //D3DFMT_X4R4G4B4 我用了D3DFMT_X8R8G8B8也不行.         //查看了一下GetAdapterModeCount的文档,//Return Values/*This method returns the number of display modes on this adapter(但是我机子上的适配器,明明支持32位的啊.) or zero if Adapter is greater than or equal to the number of adapters on the system.(D3DADAPTER_DEFAULT这个明明是0了嘛,不可能系统一个适配器都没有吧)*///不解中.....




[解决办法]
long GetNumDisplayModes(D3DFORMAT Format)

{
//查看当前设备支持多少显示模式
if(m_pD3D == NULL)
return 0;

return (long)m_pD3D->GetAdapterModeCount(D3DADAPTER_DEFAULT, Format);

}


BOOL GetDisplayModeInfo(long Num, D3DDISPLAYMODE *Mode, D3DFORMAT Format)
{
//枚举当前设备是否支持参数所给模式
long Max;

if(m_pD3D == NULL)
return FALSE;


Max = GetNumDisplayModes(Format);

//如果给定数目超过所支持的显示数目,返回错误
if(Num >= Max)
return FALSE;

//枚举模式看设备是否支持

if(FAILED(m_pD3D->EnumAdapterModes(D3DADAPTER_DEFAULT,Format, Num, Mode)))
return FALSE;


return TRUE;

}

读书人网 >网络游戏

热点推荐