Want more features on Pastebin? Sign Up, it's FREE!
Guest

VertexElement

By: default_ex on Jul 25th, 2012  |  syntax: C#  |  size: 0.50 KB  |  views: 20  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public struct VertexElement
  2. {
  3.     public string Name;
  4.     public int Size;
  5.     public VertexAttribPointerType Type;
  6.     public bool Normalized;
  7.     public IntPtr Offset;
  8.  
  9.     public void Apply(ShaderProgram shaderProgram, int stride = 0)
  10.     {
  11.         int index = GL.GetAttribLocation(shaderProgram.ID, Name);
  12.         if (index != -1)
  13.         {
  14.             GL.VertexAttribPointer(index, Size, Type, Normalized, stride, Offset);
  15.             GL.EnableVertexAttribArray(index);
  16.         }
  17.     }
  18. }
clone this paste RAW Paste Data