Studying DirectX. I connect the z buffer, but it does not work! But then there are curves ugly rippling in the eyes of flicker.
Here are my options
D3DPRESENT_PARAMETERS params; ZeroMemory(¶ms,sizeof(params)); params.Windowed = true; params.SwapEffect = D3DSWAPEFFECT_DISCARD; params.BackBufferFormat = display.Format; params.BackBufferCount = 3; params.BackBufferWidth = display.Width; params.BackBufferHeight = display.Height; params.EnableAutoDepthStencil = true; params.AutoDepthStencilFormat = D3DFMT_D24X8; params.FullScreen_RefreshRateInHz = display.RefreshRate; params.Flags = D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL; params.hDeviceWindow = hWnd;
Render condition
device->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE); device->SetRenderState(D3DRS_ZWRITEENABLE, TRUE); device->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL); device->SetRenderState(D3DRS_CULLMODE,D3DCULL_CCW); device->SetRenderState(D3DRS_LIGHTING,TRUE); device->SetRenderState (D3DRS_AMBIENT, 0xaaaaaa);
And buffer cleaning
device->Clear( 0, NULL, D3DCLEAR_TARGET| D3DCLEAR_ZBUFFER,D3DCOLOR_XRGB(0,0,255), 1.0f, 0 );
Where cant tell me pliz.