/// <summary>
 /// Checks that this index buffer's <see cref="ElementType"/> is the specified one and throws an exception if it's not.
 /// </summary>
 /// <param name="elementType">The element type to compare.</param>
 private void ValidateCorrectElementType(DrawElementsType elementType)
 {
     if (elementType != ElementType)
     {
         throw new InvalidOperationException("To perform this operation the " + nameof(IndexBufferSubset) + "'s " + nameof(ElementType) + " must be " + elementType.ToString());
     }
 }
Exemple #2
0
        public unsafe void UpdateData(byte[] data, int start, int count)
        {
            if (m_elementsType != DrawElementsType.UnsignedByte)
            {
                throw new InvalidOperationException("Bad element type. Element type for this instance is: " + m_elementsType.ToString());
            }

            Bind();

            fixed(byte *ptr = data)
            {
                BufferData((IntPtr)ptr, start, count, sizeof(byte));
            }

            m_count = count - start;
        }