XNA:DrawUserPrimitives - 绘制填充矩形

时间:2012-02-10 01:26:55

标签: c# xna primitive

我有一个使用“DrawUserPrimitives”的工作线绘图代码 我已经设置了一个使用线条和VectorPositionColor“绘制矩形”的函数

VertexPositionColor[] lineVertices = new VertexPositionColor[5];
lineVertices[0].Position = new Vector3(inMidPoint.X - halfWidth, inMidPoint.Y - halfLength, 0);
lineVertices[0].Color = inLineColor;

等。

basicEffect.CurrentTechnique.Passes[0].Apply();
mGraphics.GraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineStrip, lineVertices, 0, lineVertices.Length - 1);

使用此方法,我可以创建矩形的彩色轮廓。现在,如何使用此系统用颜色填充该矩形?

1 个答案:

答案 0 :(得分:1)