Tuesday, November 24, 2009

How to draw lines in 3D space with XNA

In XNA, we can use DrawUserPrimitives of GraphicsDevice.

Here is one example:
device.DrawUserPrimitives(PrimitiveType.LineList, vertices, 0, 9);

Parameters:
1> Set primitive type as line list, it means the method is going to draw a line list.
2> VertexPositionColor array, it contains vertexes with colors.
3> offset
4> Primitive count, here is for line count.

No comments:

Post a Comment