Jump to content
  • Advertisement
Sign in to follow this  
marlboro

z-buffer not working...

This topic is 4888 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I've got a z-buffer issue happening that I can't seem to get fixed. I feel sure it's simply a setup issue, so I'll try and layout the scenario. First, I am placing two quads in world space at 0,0,0 and 0.5,0.5,0.5. The second quad is being draw last (on purpose), but it should be occluded by the first quad. This is not happening! Quad two displays on top of quad one. If I rotate quad one, it will jump in front of or behind quad two. The important code snips are as follows: d3dpp.EnableAutoDepthStencil = true; d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8; SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE ); D3DXMatrixPerspectiveFovLH(..., 1.57f, 1.33f, 0.0f, 1.0f); Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, m_rgbaClear, 1.0f, 0); Thanks, marlboro

Share this post


Link to post
Share on other sites
Advertisement
Thank you! You confirmed my suspicion that I had something setup wrong. I changed the zn and zf parameters of D3DXMatrixPerspectiveFovLH(...) to 0.1f and 1000.0f and everything works grand.

Thanks again!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!