   Direct3D 8.1 Clear triggers D3DERR_INVALIDCALL
  hey,here is my Clear function calling which drops error:Clear (0, nil, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1, 0);Z buffer is enabled. Actualy, normally it does work, but now that I set a surface to render to, it fails. I heard I should attach a zbuffer or stencil buffer to this 2nd surface, but how?   
  It returns D3DERR_INVALIDCALL because the render target you're Clear()ing doesn't have a z-buffer attached to it. You need to attach one with a call to SetDepthStencilSurface() (At least that's what you do in DX9, it's probably the same in DX8).Out of interest, why are you using DX8?   ;  on another way:Device->CreateDepthStencilSurface (ResolutionX,ResolutionY, D3DFMT_D16, D3DMULTISAMPLE_NONE, newstencil)andDevice->SetRenderTarget (3rdSurface, newstencil) drawingsDevice->SetRenderTarget (BackBuffer, 0)I get a little "crashed" image, it looks as if I didnt clear something. I clear like this:Clear (0,null, D3DCLEAR_ZBUFFER | D3DCLEAR_TARGET, 0x000000, 1, 0)and no change. Without setting "newstencil", it worked good.   ;  I think I should clear this new stencil or Z buffer, how?   