可分为4步:
1:获取接口Idirect3D9的指针
IDirect3D9* d3d9 = 0;
d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
2:检查设备性能
D3DCAPS9 caps;
d3d9->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &caps);
3:初始化D3DPRESENT_PARAMETERS结构
D3DPRESENT_PARAMETERS d3dpp;
d3dpp.BackBufferWidth
d3dpp.BackBufferHeight
d3dpp.BackBufferFormat
d3dpp.BackBufferCount
d3dpp.MultiSampleType
d3dpp.MultiSampleQuality
d3dpp.SwapEffect
d3dpp.hDeviceWindow
d3dpp.Windowed
d3dpp.EnableAutoDepthStencil
d3dpp.AutoDepthStencilFormat
d3dpp.Flags
d3dpp.FullScreen_RefreshRateInHz
d3dpp.PresentationInterval
4:创建IDirect3DDevice9对象
IDirect3D9::CreateDevice