CheckDeviceFormat function does not return D3D_OK
hello all,
I am Running the following code to select the best depth buffer but
the problem is the pointer is going in the else part and hence i not
able to select the depth buffer. Is there any solution what i should to
so that i can get the depth buffer
LPDIRECT3D8 m_pD3D;
//Select the best depth buffer, select 32, 24 or 16 bit
if(m_pD3D->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
d3ddm.Format, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, D3DFMT_D32) ==
D3D_OK)
{
d3dpp.AutoDepthStencilFormat = D3DFMT_D32;
d3dpp.EnableAutoDepthStencil = TRUE;
WriteToLog("\t32bit depth buffer selected");
}
else if(m_pD3D->CheckDeviceFormat(D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL, d3ddm.Format, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE,
D3DFMT_D24X8) == D3D_OK)
{
d3dpp.AutoDepthStencilFormat = D3DFMT_D24X8;
d3dpp.EnableAutoDepthStencil = TRUE;
WriteToLog("\t24bit depth buffer selected");
}
else if(m_pD3D->CheckDeviceFormat(D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL, d3ddm.Format, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE,
D3DFMT_D16) == D3D_OK)
{
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;
d3dpp.EnableAutoDepthStencil = TRUE;
WriteToLog("\t16bit depth buffer selected");
}
else
{
d3dpp.EnableAutoDepthStencil = FALSE;
WriteToLog("\tUnable to select depth buffer.");
}
Here "WriteToLog" is my own function to write in file.
thanks in advance
Meenal
date: 5 Jun 2006 21:48:55 -0700
author: Meenal Gupta