Archived

This topic is now archived and is closed to further replies.

Shooter

Z-Buffer problems

Recommended Posts

Hi, I''ve got some trouble with my DirectX 8.1 application: I am drawing some blocks, but their surfaces are overlapping sometimes. So, I decided to use a z-buffer to solve this problem, but it does not work that good: The surfaces do not appear any more, there are only some single pixels visible. What went wrong? I don''''t need any signature ;-)

Share this post


Link to post
Share on other sites
Take a close look at the near and far clipping planes of your view frustum. Make sure the blocks you are rendering fall within them. Right now it sounds like the two planes are really close together and you are seeing a small section of your blocks between them?

Share this post


Link to post
Share on other sites
Also check
SetRenderState( D3DRS_ZFUNC, .....);

Make sure you set the correct Z buffer comparison function.

Might be that you have set it to D3DCMP_LESS, but you really should have set D3DCMD_GREATER.


Hope this helps

Share this post


Link to post
Share on other sites
I solved the problem on my own - I forgot to set the appropriate flag in the Clear() function.

I don''''t need any signature ;-)

Share this post


Link to post
Share on other sites