passing structs as attributes?

is it possible to create a vertex attribute as a struct? or is it possible for an array to be a vertex attribute? i’ve seen it passed in as a uniform for lighting


uniform struct
{
vec3 position;
vec3 direction;
vec3 color;
float attenuation'
} lights[10];


or something like that. is this possible with vertex attributes?

Vertex attributes can only have types of FLOAT, FLOAT_VEC2, FLOAT_VEC3, FLOAT_VEC4, FLOAT_MAT2, FLOAT_MAT3, and FLOAT_MAT4.

In the case of the matrix types, each column has its own generic attribute binding. Thus if you had “attribute mat4 t” and t was bound to attribute 1, the first column is 1, then second is 2, the third is 3, etc.

This also makes me think that array attributes are not allowed but I haven’t tried it and couldn’t find any language specific enough in the documentation. It might be possible to use structs that only depended on the float vector/matrix types, and you looked up each attribute by fully qualified name (“light.position”). However, I feel like this probably doesn’t work, you could try it though.