Esempio n. 1
0
 public void PushFloat(uint count, bool isNormalized)
 {
     Elements.Add(new VertexBufferElement()
     {
         Type = VertexAttribType.Float, Count = count, IsNormalized = isNormalized
     });
     Stride += count * VertexBufferElement.GetSizeOfType(VertexAttribType.Float);
 }
Esempio n. 2
0
 public void PushByte(uint count, bool isNormalized)
 {
     Elements.Add(new VertexBufferElement()
     {
         Type = VertexAttribType.UnsignedByte, Count = count, IsNormalized = isNormalized
     });
     Stride += count * VertexBufferElement.GetSizeOfType(VertexAttribType.UnsignedByte);
 }
Esempio n. 3
0
        public void AddBuffer(VertexBuffer vb, VertexBufferLayout layout)
        {
            Bind();
            vb.Bind();
            uint offset = 0;

            for (int i = 0; i < layout.Elements.Count; i++)
            {
                VertexBufferElement element = layout.Elements[i];
                Gl.VertexAttribPointer((uint)i, (int)element.Count, element.Type, element.IsNormalized,
                                       (int)layout.Stride, new IntPtr(offset));
                Gl.EnableVertexAttribArray((uint)i);

                offset += element.Count * VertexBufferElement.GetSizeOfType(element.Type);
            }
        }