|
|
我写了个D3D程序,部分代码如下,变量都已经声明
// create a D3D object
if( NULL == ( pD3D = Direct3DCreate8( D3D_SDK_VERSION ) ) )
{
MessageBox( hWnd, "Direct3D Error!", "Unable to init the Direct3D!", MB_ICONERROR );
return E_FAIL;
}
// get the default adapter
if( FAILED( pD3D->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &d3ddm) ) )
{
return E_FAIL;
}
// get the window size
GetWindowRect( hWnd, &rcWindowBounds );
GetWindowRect( hWnd, &rcWindowClient );
ZeroMemory( &d3dpp, sizeof(d3dpp) );
d3dpp.hDeviceWindow = hWnd;
d3dpp.BackBufferWidth = rcWindowClient.right - rcWindowClient.left;
d3dpp.BackBufferHeight = rcWindowClient.bottom - rcWindowClient.top;
d3dpp.BackBufferFormat = d3ddm.Format;
d3dpp.BackBufferCount = 1;
d3dpp.SwapEffect = D3DSWAPEFFECT_FLIP;
d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
d3dpp.EnableAutoDepthStencil = D3DFMT_D16;
d3dpp.Windowed = TRUE;
// create the device object
hReturn = pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp, &pD3dDevice );
但是,在调用pD3D->CreateDevice函数时,却发生了错误,我的版本是8.0的,返回值是 hReturn = -2005530516
|
|