예제 #1
0
 ///<summary> Given a elementbuffer, fill with indexes from an array. Set ElementBuffer, ElementIndexSize, BaseIndexOffset, DrawCount </summary>
 public void CreateElementIndexUShort(GLBuffer elementbuf, ushort[] indexes, int base_index = 0)
 {
     ElementBuffer = elementbuf;
     ElementBuffer.AllocateFill(indexes);
     ElementIndexSize = DrawElementsType.UnsignedShort;
     BaseIndexOffset  = base_index;
     DrawCount        = indexes.Length;
 }
예제 #2
0
        ///<summary> Given a elementbuffer, fill with indexes from an array. Drawtype sets the element index size. Set ElementBuffer, ElementIndexSize, BaseIndexOffset, DrawCount </summary>
        public void CreateElementIndex(GLBuffer elementbuf, uint[] eids, DrawElementsType drawtype, int base_index = 0)
        {
            ElementBuffer = elementbuf;

            if (drawtype == DrawElementsType.UnsignedByte)
            {
                ElementBuffer.AllocateFill(eids.Select(x => (byte)x).ToArray());
            }
            else if (drawtype == DrawElementsType.UnsignedShort)
            {
                ElementBuffer.AllocateFill(eids.Select(x => (ushort)x).ToArray());
                ElementIndexSize = DrawElementsType.UnsignedShort;
            }
            else
            {
                ElementBuffer.AllocateFill(eids.ToArray());
                ElementIndexSize = DrawElementsType.UnsignedInt;
            }

            ElementIndexSize = drawtype;
            BaseIndexOffset  = base_index;
            DrawCount        = eids.Length;
        }