Sign in to follow this  
prux

Direct3D 8.1 Clear triggers D3DERR_INVALIDCALL

Recommended Posts

prux    138
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?

Share this post


Link to post
Share on other sites
Evil Steve    2017
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?

Share this post


Link to post
Share on other sites
prux    138
on another way:

Device->CreateDepthStencilSurface (ResolutionX,ResolutionY, D3DFMT_D16, D3DMULTISAMPLE_NONE, newstencil)

and

Device->SetRenderTarget (3rdSurface, newstencil)
drawings
Device->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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this