private void EnableAttributes(VertexAttributeSet attrs)
 {
     foreach (var attr in attrs)
     {
         attr.Load();
     }
 }
 private void EnableAttributes(VertexAttributeSet attrs, IEnumerable <int> indices)
 {
     foreach (var attr in attrs)
     {
         attr.Load();
     }
     foreach (int i in indices)
     {
         GL.EnableVertexAttribArray(i);
     }
 }
Example #3
0
 public Sprite(Texture tex, IBindableVertexBuffer buffer, int bufferInd, int depth = 0)
     : base(
         tex,
         PrimitiveType.Quads,
         new AttributedVertexBuffer(buffer, VertexAttributeSet.FromType <TexturedVertex2>()),
         VertexIndices.FromRange(bufferInd, 4),
         null,
         depth)
 {
     index = bufferInd;
 }
 public SpriteLoader(BufferUsageHint hint, IBindableVertexBuffer buffer)
     : base(hint, new AttributedVertexBuffer(buffer, VertexAttributeSet.FromType <TexturedVertex2>()))
 {
 }
 public void WithAttributes(VertexAttributeSet attrs, IEnumerable <int> indices, Action inner)
 {
     EnableAttributes(attrs, indices);
     try { inner(); }
     finally { DisableAttributes(indices); }
 }
 public void WithAttributes(VertexAttributeSet attrs, Action inner)
 {
     EnableAttributes(attrs);
     try { inner(); }
     finally { DisableAttributes(attrs.Indices); }
 }
 public AttributedVertexBuffer(IBindableVertexBuffer buffer, VertexAttributeSet attributes)
 {
     VBuffer          = buffer;
     VertexAttributes = attributes;
 }