IndexBuffer myIndexBuffer = new IndexBuffer(GraphicsDevice, IndexElementSize.ThirtyTwoBits, 100, BufferUsage.WriteOnly); myIndexBuffer.SetData(indices); GraphicsDevice.Indices = myIndexBuffer;
VertexBuffer myVertexBuffer = new VertexBuffer(GraphicsDevice, VertexPositionColor.VertexDeclaration, 100, BufferUsage.WriteOnly); IndexBuffer myIndexBuffer = new IndexBuffer(GraphicsDevice, IndexElementSize.SixteenBits, 200, BufferUsage.WriteOnly); myVertexBuffer.SetData(vertices); myIndexBuffer.SetData(indices); GraphicsDevice.SetVertexBuffer(myVertexBuffer); GraphicsDevice.Indices = myIndexBuffer;This example creates both a VertexBuffer and an IndexBuffer object, sets their data, and binds them to the graphics device. The package library for using IndexBuffer Bind in C# is the Microsoft.Xna.Framework.Graphics namespace, which is part of the XNA Framework.