本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.GraphicsDevice.DrawUserIndexedPrimitives方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicsDevice.DrawUserIndexedPrimitives方法的具体用法?C# GraphicsDevice.DrawUserIndexedPrimitives怎么用?C# GraphicsDevice.DrawUserIndexedPrimitives使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Graphics.GraphicsDevice
的用法示例。
在下文中一共展示了GraphicsDevice.DrawUserIndexedPrimitives方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawQuad
public static void DrawQuad(Effect effect, Quad quad, GraphicsDevice gd)
{
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
gd.DrawUserIndexedPrimitives<VertexPositionNormalTexture>(PrimitiveType.TriangleList, quad.Vertices, 0, 4, quad.Indexes, 0, 2);
}
}
示例2: Render
public void Render (GraphicsDevice device, Texture defaultTexture)
{
device.Textures[0] = _texture ?? defaultTexture;
device.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, _vertexBuffer, 0, _vertexBuffer.Length, _indexBuffer, 0, _indexBuffer.Length / 3);
}
示例3: Render
//float x = 0;
public void Render(GraphicsDevice device, CQT.Model.Point p1, CQT.Model.Point p2, CQT.Model.Point p3, Color color)
{
BasicEffect _effect = new BasicEffect(device);
_effect.Texture = ColorToTexture(device, color, 1, 1);
_effect.TextureEnabled = true;
//_effect.VertexColorEnabled = true;
VertexPositionTexture[] _vertices = new VertexPositionTexture[3];
_vertices[0].Position = PointToVector3(ref p1);
_vertices[1].Position = PointToVector3(ref p2);
_vertices[2].Position = PointToVector3(ref p3);
foreach (var pass in _effect.CurrentTechnique.Passes)
{
pass.Apply();
device.DrawUserIndexedPrimitives<VertexPositionTexture>
(
PrimitiveType.TriangleStrip, // same result with TriangleList
_vertices,
0,
_vertices.Length,
new int[] { 0, 1, 2 },
0,
1
);
}
}