How to disable the depth buffer?

I do not see RenderStateas a member of a class GraphicsDevicewhere functions are used to disable the depth buffer. Does anyone know how to do this with this new API 4.0?

It would be great if I could somehow get access to a full-fledged class RenderState. GraphicsDeviceseems to have gotten some, but not nearly all!

+5
source share
1 answer

Ah .. I would install GraphicsDevice.DepthStencilStatein an instance DepthStencilStatewith any number of properties set. It seems to have RenderStatebeen broken into a bunch of other states. I searched in the individual properties inside GraphicsDevicebefore, but they seem to be better organized now to simplify state management.

depthState = new DepthStencilState();
depthState.DepthBufferEnable = true; /* Enable the depth buffer */
depthState.DepthBufferWriteEnable = true; /* When drawing to the screen, write to the depth buffer */

GraphicsDevice.DepthStencilState = depthState;
+2
source

All Articles