attributeParametersFor

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).

Members

Aliases

attributeParametersFor
alias attributeParametersFor = TypeTuple!(size, GL_type!base_type, normalized, T.sizeof, null)
Undocumented in source.
base_type
alias base_type = element_type
Undocumented in source.
element_type
alias element_type = E
Undocumented in source.
element_type
alias element_type = E
Undocumented in source.
element_type
alias element_type = T
Undocumented in source.

Manifest constants

normalized
enum normalized;
Undocumented in source.
size
enum size;
Undocumented in source.
size
enum size;
Undocumented in source.
size
enum size;
Undocumented in source.

Examples

// 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);

Meta