[英]XNA: DrawUserPrimitives - Drawing FILLED rectangles
I have a working line drawing code going using "DrawUserPrimitives" I have set up a function to "draw a rectangle" using a linestrip and VectorPositionColor 我有一个使用“ DrawUserPrimitives”的工作线绘制代码,我已经设置了使用linestrip和VectorPositionColor“绘制矩形”的函数
VertexPositionColor[] lineVertices = new VertexPositionColor[5];
lineVertices[0].Position = new Vector3(inMidPoint.X - halfWidth, inMidPoint.Y - halfLength, 0);
lineVertices[0].Color = inLineColor;
etc.. 等等..
basicEffect.CurrentTechnique.Passes[0].Apply();
mGraphics.GraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineStrip, lineVertices, 0, lineVertices.Length - 1);
Using this method I can create the colored outline of a rectangle. 使用这种方法,我可以创建矩形的彩色轮廓。 Now, how can I fill in that rectangle with a color, using this system?
现在,如何使用该系统用颜色填充该矩形?
使用TriangleStrip代替LineStrip- http://msdn.microsoft.com/zh-cn/library/microsoft.xna.framework.graphics.primitivetype.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.