// These two lines do the exact same. glVertexAttribPointer(1, attributeParametersFor!int); glVertexAttribPointer(1, 1, GL_INT, false, int.sizeof, null);
// These two lines do the exact same. glVertexAttribPointer(1, attributeParametersFor!Matrix3f); glVertexAttribPointer(1, 9, GL_FLOAT, false, Matrix3f.sizeof, null);
// These two lines do the exact same. glVertexAttribPointer(1, attributeParametersFor!(Vector!(Normalized!ubyte, 4))); glVertexAttribPointer(1, 4, GL_UBYTE, true, Vector!(Normalized!ubyte, 4).sizeof, null);
struct Vertex { HVector4f position; Vector3f normal; HVector4f color; } // These two lines do the exact same. glVertexAttribPointer(1, attributeParametersFor!(Vertex, "normal")); glVertexAttribPointer(1, 3, GL_FLOAT, false, Vertex.size, cast(const(void)*)Vertex.normal.offsetof);
The (automatically deduced) correct AttributeParameters for T.
Works for GLdouble, GLfloat, GLint, GLuint, GLshort, GLushort, GLbyte, GLubyte, Normalized versions of these, and Matrices, Vectors and HVectors of all these.
The second version takes the name the member of T, for when the buffer contains an array of T but only a single member of that T is what you want parameters for. This automatically sets the stride and the offset to to the correct values (T.sizeof and T.member.offsetof, respectively).