   Z buffer setting
  Hi, could someone show me the steps to set up Zbuffer with Direct3D9, i know only these two things:   ......hr=g_d3d_device->Clear(0,NULL,    D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00000000,   1.0f,0);......g_d3d_device->SetRenderState(D3DRS_ZENABLE,D3DZB_TRUE);......but when i run the program the screen is all black...(and with Zbuffer deactivated all works fine(but without Zbuffer))ThanksKev 
  Are you creating the depth buffer when you create the device?What are your viewport settings? I like pie. ;  These are the device setting up and initialization HRESULT dhInitDevice(IDirect3D9 *p_d3d,bool p_fullscreen,HWND p_window, DWORD p_width,DWORD p_height,D3DFORMAT p_format, D3DFORMAT p_depth,IDirect3DDevice9 **p_device, D3DPRESENT_PARAMETERS *p_pp){   HRESULT hr;   ZeroMemory(p_pp,sizeof(D3DPRESENT_PARAMETERS));    p_pp->BackBufferCount= 1;p_pp->MultiSampleType=D3DMULTISAMPLE_NONE;    p_pp->MultiSampleQuality=0;    p_pp->SwapEffect= D3DSWAPEFFECT_DISCARD;    p_pp->hDeviceWindow  = p_window;p_pp->Flags=0;p_pp->FullScreen_RefreshRateInHz=D3DPRESENT_RATE_DEFAULT;    p_pp->PresentationInterval=D3DPRESENT_INTERVAL_IMMEDIATE;    p_pp->BackBufferFormat  = p_format;    if(p_depth==D3DFMT_UNKNOWN){ p_pp->EnableAutoDepthStencil=FALSE;   }else{ p_pp->EnableAutoDepthStencil=TRUE;   }   p_pp->AutoDepthStencilFormat=p_depth;    if(p_fullscreen){ p_pp->Windowed= FALSE; p_pp->BackBufferWidth   = p_width; p_pp->BackBufferHeight  = p_height;   }else{ p_pp->Windowed= TRUE;   } hr=p_d3d->CreateDevice(D3DADAPTER_DEFAULT,    D3DDEVTYPE_HAL,   p_window,   D3DCREATE_SOFTWARE_VERTEXPROCESSING,   p_pp,   p_device); return hr;}How to create the depth buffer?;  Ok, it was the depth buffer, now i create it and works fine with Zbuffer Thanks 