0
我按照教程新的代碼,但我發現這個問題:Monogame什麼是對monogame爲GraphicsDevice的
GraphicsDevice.RenderState.CullMode = CullMode.None;
GraphicsDevice.VertexDeclaration = new VertexDeclaration(GraphicsDevice, VertexPositionColor.VertexElements);
此代碼是在monogame丟失,我該怎麼辦? 這是本教程的完整代碼:
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
GraphicsDevice.RenderState.CullMode = CullMode.None;
GraphicsDevice.VertexDeclaration = new VertexDeclaration(GraphicsDevice, VertexPositionColor.VertexElements);
BasicEffect effect = new BasicEffect(GraphicsDevice, null);
effect.World = Matrix.Identity;
effect.View = camera.viewMatrix;
effect.Projection = camera.projectionMatrix;
effect.VertexColorEnabled = true;
effect.Begin();
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Begin();
GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, verts, 0, 2);
pass.End();
}
effect.End();
base.Draw(gameTime);
}
謝謝。
我understant改變頂點聲明,謝謝。 –