0
Я пытаюсь нарисовать зеленый треугольник. Мне удалось нарисовать треугольник, но он белый, а не зеленый. Кто-нибудь есть идея, что вызывает это?Почему мой треугольник белый?
Вот мой код:
protected override void LoadContent()
{
_vertexPositionColors = new[]
{
new VertexPositionColor(new Vector3(0, 0, 0), Color.Green),
new VertexPositionColor(new Vector3(100, 0, 0), Color.Red),
new VertexPositionColor(new Vector3(100, 100, 0), Color.Blue)
};
_basicEffect = new BasicEffect(GraphicsDevice);
_basicEffect.World = Matrix.CreateOrthographicOffCenter(
0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 0, 1);
_basicEffect.LightingEnabled = false;
_basicEffect.VertexColorEnabled = true;
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
EffectTechnique effectTechnique = _basicEffect.Techniques[0];
EffectPassCollection effectPassCollection = effectTechnique.Passes;
foreach (EffectPass pass in effectPassCollection)
{
pass.Apply();
GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, _vertexPositionColors, 0, 1);
}
base.Draw(gameTime);
}
Это фиксировало это. благодаря – Wipie44