private void DrawHardwareInstancing(Matrix[] matrix, int vertexCount, int primitiveCount)
        {
            const int sizeofMatrix     = sizeof(float) * 16;
            int       instanceDataSize = sizeofMatrix * matrix.Length;

            DynamicVertexBuffer instanceDataStream = new DynamicVertexBuffer(game.GraphicsDevice,
                                                                             instanceDataSize,
                                                                             BufferUsage.WriteOnly);

            instanceDataStream.SetData(matrix, 0, matrix.Length, SetDataOptions.Discard);

            VertexStreamCollection vertices = game.GraphicsDevice.Vertices;

            vertices[0].SetFrequencyOfIndexData(matrix.Length);

            vertices[1].SetSource(instanceDataStream, 0, sizeofMatrix);
            vertices[1].SetFrequencyOfInstanceData(1);

            game.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList,
                                                      0, 0, vertexCount, 0, primitiveCount);

            vertices[0].SetSource(null, 0, 0);
            vertices[1].SetSource(null, 0, 0);
        }
 public void SetUp()
 {
     vsc = game.GraphicsDeviceManager.GraphicsDevice.Vertices;
 }