|
|
CreateDevice()的时候出错,但是不知道错在哪里
函数如下
bool InitDirectX(HWND hWnd,IDirect3D9 *D3D,D3DDISPLAYMODE d3ddm,D3DPRESENT_PARAMETERS d3dpp,IDirect3DDevice9 *D3DDevice)
{
D3D=Direct3DCreate9(D3D_SDK_VERSION);
if(D3D==NULL)
{
MessageBox(NULL,"Error!","Create_D3D",MB_OK);
return false;
}
if(FAILED(D3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&d3ddm)))
{
MessageBox(NULL,"Error!","Get_DisPlayMode",MB_OK);
return false;
}
ZeroMemory(&d3dpp,sizeof(D3DPRESENT_PARAMETERS));
d3dpp.Windowed=true;
d3dpp.SwapEffect=D3DSWAPEFFECT_FLIP;
d3dpp.BackBufferFormat=d3ddm.Format;
d3dpp.BackBufferWidth=Window_Width;
d3dpp.BackBufferHeight=Window_Height;
//下面的代码就过不去了
if(FAILED(D3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,hWnd,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&d3dpp,&D3DDevice)))
{
MessageBox(NULL,"Error!","D3DDevice_Create",MB_OK);
return false;
}
return 1;
}
|
|