Sign in to follow this  
akira32

EnableAutoDepthStencil On 3D and 2D

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
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

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