I want to load a vertex buffer with vertices of struct Vertex
:
struct Vertex {
Vector3 position;
Vector3 normal;
Vector2 uv;
int groups[10];
float weights[10];
};
According to khronos manual, the number of elements in vertex attributes must be 1,2,3,4
. If that is the case how do I load the vertex attributes consisting of more elements, in this case 10?
Is this not valid?
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)0);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, normal));
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, uv));
glVertexAttribIPointer(3, 10, GL_INT, sizeof(Vertex), (void*)offsetof(Vertex, groups));
glVertexAttribPointer(4, 10, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, weights));
I need groups and weight vertex attributes for skeletal deformation.