如何禁用深度缓冲区?

时间:2010-09-21 18:54:08

标签: c# windows-phone-7 xna xna-4.0 depth-buffer

我没有看到RenderState作为GraphicsDevice类中的成员,这是禁用深度缓冲区的函数。有人知道如何使用这个新的4.0 API吗?

如果我能以某种方式访问​​一个完整的RenderState类似的课程,那将会很棒。GraphicsDevice似乎已经获得了一些,但几乎没有![/ p>

1 个答案:

答案 0 :(得分:2)

啊..我会将GraphicsDevice.DepthStencilState设置为DepthStencilState的实例,并设置任意数量的属性。似乎RenderState被分成了许多其他状态。我以前在GraphicsDevice内部的个别属性中寻找,但为了更容易的状态管理,它们现在看起来更好了。

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;
相关问题