【问题标题】:XNA 4.0 Change GraphicsDevice Default DepthStencilState ValuesXNA 4.0 更改 GraphicsDevice 默认 DepthStencilState 值
【发布时间】:2019-01-11 13:48:44
【问题描述】:

我想将我的 GraphicsDevice 的默认值之一更改为:

GraphicsDevice.DepthStencilState.DepthBufferEnable = true;

但是,我只知道如何在运行时在 Draw 方法中通过放置这段代码来更改它(这意味着每次调用 draw 方法时都会更改值!):

DepthStencilState state = new DepthStencilState();
state.DepthBufferEnable = true;
GraphicsDevice.DepthStencilState = state;

有人知道如何以有效的方式更改一次吗?

【问题讨论】:

    标签: c# xna monogame xna-4.0


    【解决方案1】:

    您可以在 GraphicsDevice 可用的任何地方使用此代码。我会把它放在 LoadContent() 或 Initalize() 中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-07-05
      • 2014-11-06
      • 1970-01-01
      • 2018-10-09
      • 2016-04-18
      • 1970-01-01
      • 2020-02-28
      • 2016-06-01
      相关资源
      最近更新 更多