【发布时间】:2019-11-11 01:12:19
【问题描述】:
我想在屏幕上绘制一些调试信息,但这会导致渲染模型出现问题。我在互联网上找到了一些解决方案,但它不起作用。也许我太笨了,但我不知道怎么了。 这是Draw方法:
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.DarkCyan);
spriteBatch.Begin();
player.Draw(dt);
spriteBatch.DrawString(gamefont, "render Time :" + gameTime.ElapsedGameTime.TotalSeconds, new Vector2(0, 85), Color.White);
spriteBatch.End();
effect.View = player.view;
effect.Projection = player.projection;
effect.Texture = dirtTexture;
GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
GraphicsDevice.BlendState = BlendState.Opaque;
GraphicsDevice.DepthStencilState = DepthStencilState.Default;
foreach (EffectPass p in effect.CurrentTechnique.Passes)
{
p.Apply();
effect.World = player.world;
GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, buffer.VertexCount / 3);
}
base.Draw(gameTime);
}
【问题讨论】:
-
如您所见,我重置了深度缓冲区,所以这不是问题。还有其他东西,但我无法得到什么。
-
输出有什么问题?
-
我在描述中添加了图片。我不知道为什么会这样。我使用了刹车点来检查 GraphicsDevice 的值,但在绘制 3d 模型时我没有发现变化。
标签: c# 3d render monogame spritebatch