Advertisement
default_ex

VertexElement

Jul 25th, 2012
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement