我想在屏幕上绘制一些调试信息,但这会导致渲染模型出现问题。我在互联网上找到了一些解决方案,但它不起作用。也许我太笨了,但我不知道出了什么问题。这是绘制方法:
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);
}
小唯快跑啊
相关分类