示例#1
0
 public void AddBuffer(ref BufferObject bufferObject, BufferLayout bufferLayout = null)
 {
     Bind();
     bufferObject.Bind();
     _buffers.Add(bufferObject);
     if (bufferLayout != null)
     {
         int offset = 0;
         for (int i = 0; i < bufferLayout.Elements.Count; i++)
         {
             LayoutElement la = bufferLayout.Elements[i];
             GL.VertexAttribPointer(i, la.Count, la.Type, la.Normalized, bufferLayout.Stride, offset);
             GL.EnableVertexAttribArray(i);
             offset += LayoutElement.GetSizeOfType(la.Type) * la.Count;
         }
     }
 }