|
|
发表于 2005-8-28 23:58:00
|
显示全部楼层
Re:dx9下的3d绘图怎样设为全屏模式?
HRESULT InitialiseD3D(HWND hWnd, UINT nWidth, UINT nHeight)
{
.................... // 省略代码若干
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory(&d3dpp, sizeof(d3dpp));
/* //窗口模式:
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_COPY_VSYNC;
d3dpp.BackBufferFormat = d3ddm.Format;
*/
//全屏模式
d3dpp.Windowed = FALSE;
d3dpp.BackBufferCount = 1;
d3dpp.BackBufferFormat = d3ddm.Format;
d3dpp.BackBufferWidth = d3ddm.Width;
d3dpp.BackBufferHeight = d3ddm.Height;
d3dpp.hDeviceWindow = hWnd;
d3dpp.SwapEffect = D3DSWAPEFFECT_COPY_VSYNC;
d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
d3dpp.FullScreen_PresentationInterval = D3DPRESENT_INTERVAL_ONE;
//设置深度缓冲
d3dpp.AutoDepthStencilFormat=D3DFMT_D16; //选择深度缓冲为 D3DFMT_D16
d3dpp.EnableAutoDepthStencil=TRUE; //深度缓冲是否可用:TRUE
//Create a Direct3D device.
if(FAILED(g_pD3D->CreateDevice(
D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, // d3dpp 在上面已经设置好了
&g_pD3DDevice))) //创建了D3D设备之后将设备地址
//赋予g_pD3DDevice
{
return E_FAIL;
}
|
|