本文整理匯總了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
);
}
}