dirext里面有两代码不明白 可以帮我解释一下吗
HRESULT InitD3D(HWND hWnd){
if(g_pD3D == NULL)
{
return E_FAIL;
}
typedef struct _D3DDISPLAYMODE
{
UINT Width;
UINT Height;
UINT RefreshRate;
D3DFORMAT Format;
} D3DDISPLAYMODE
D3DDISPLAYMODE d3ddm;
if(FAILED(g_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm)))
{
return E_FAIL;
}
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory(&d3dpp, sizeof(d3dpp));
d3dpp.Windowed = TRUE;
d3dpp.BackBufferFormat = d3ddm.Format;
D3DCAPS9 caps;
g_pD3D ->GetDeviceCaps(
D3DADAPTER_DEFAULT, // 主显示设备
D3DDEVTYPE_HAL, // 硬件处理的方式
&caps //返回填充后的D3DCAPS9结构,包含主显示设备的能力
); // 是否可以使用硬件顶点处理?
int vp = 0;
if( caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT )
{
// 是,支持硬件顶点处理
vp = D3DCREATE_HARDWARE_VERTEXPROCESSING;
}
else
{
// 不,只能用软件顶点处理
vp = D3DCREATE_SOFTWARE_VERTEXPROCESSING;
}
if(FAILED(g_pD3D->CreateDevice( D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
hWnd,
vp,
&d3dpp,
&g_pD3DDevice)))
{
return E_FAIL;
}
return S_OK;
}
void Render()
{
if(g_pD3DDevice)
{
g_pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(255,120,0), 1.0f, 0);
g_pD3DDevice->Present(NULL, NULL, NULL, NULL);
}
}
void CleanUp()
{
if(g_pD3DDevice)
{
g_pD3DDevice->Release();
g_pD3DDevice=NULL;
}
if(g_pD3D)
{
g_pD3D->Release();
g_pD3D=NULL;
}
}
就是红色的那一段,那个if里边的DevCaps是怎么来的,那个D3DDEVCAPS_HWTRANSFORMANDLIGHT 什么意思··并且 vp =D3DCREATE_HARDWARE_VERTEXPROCESSING中的D3DCREATE_HARDWARE_VERTEXPROCESSING它是一个int型的数据?