Jump to content
  • Advertisement
Sign in to follow this  
akira32

EnableAutoDepthStencil On 3D and 2D

This topic is 4128 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

D3DPRESENT_PARAMETERS d3dpp; ZeroMemory(&d3dpp, sizeof(d3dpp)); //d3dpp.EnableAutoDepthStencil = TRUE;//For 3D d3dpp.EnableAutoDepthStencil = FALSE;//For 2D IN MSDN: If this value is TRUE, Direct3D will manage depth buffers for the application. The words as above mean that 2D drawing doesn't use depth buffer? If I want to 3D-Drawing and 2D-Drawing, then I want to switch the value of dpp.EnableAutoDepthStencil between TRUE and FLASE? Or switch 3D or 2D Drawing,just set different FVF,but the value of d3dpp.EnableAutoDepthStencil must set to be TRUE or FALSE?

Share this post


Link to post
Share on other sites
Advertisement
Direct3D will manage your depth buffer, which doesn't mean you can't use the depth buffer for 2D applications. There's no Direct2D or DirectDraw that would make some sort of special 2D depth buffer.

Share this post


Link to post
Share on other sites
Setting EnableAutoDepthStencil to TRUE causes DirectX to automagically create a DepthStencilSurface for you, and enable Z-buffering by default.

If you select TRUE, you can still just turn off Z-buffering (using the Renderstate to do so), and the surface that was created will not be used. You can then disable or enable it in the middle of a frame as you wish.

Keep in mind, that setting this value to FALSE doesn't disable Z-buffering completely, it just means that if you want to use it, you'll need to create the surface yourself and enable it specifically.

I'd recommend using TRUE and disabling and enabling D3DRS_ZENABLE as needed.

Hope this helps.

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!