Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable the depth buffer?

I don't see a RenderState as a member in the GraphicsDevice class, which is where the functions for disabling the depth buffer used to be. Anyone know how this is done with this new 4.0 API?

It would be great if I could somehow access a full RenderState-like class somewhere.. GraphicsDevice seems to have gotten some of it, but not nearly all!

like image 472
Kalen Avatar asked Nov 06 '22 08:11

Kalen


1 Answers

Ah.. I would be setting GraphicsDevice.DepthStencilState to an instance of DepthStencilState with any number of properties set. Seems like the RenderState was broken into a bunch of other states. I was looking for in the individual properties inside of GraphicsDevice before, but they seem to be better organized now for easier 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;
like image 72
Kalen Avatar answered Nov 09 '22 09:11

Kalen