If I wanted to store extra data in a VBO for skinning (indices for indexing into an array of matrices of bones and floats for applying weights to those bones) How would I go about accessing that data in GLSL? I already know how to put the data in the buffer, interleaved with the rest of the data.
For example I want each vertex for a model to contain:
Vec3 position; Vec3 normal; Vec4 color; Vec2 texCoords; int boneCount; int boneIndex; float boneWeight;
Then drawing like:
bind(vertexBufferID); glVertexPointer(3, GL11.GL_FLOAT, stridePlus, 0 * 4); glNormalPointer(GL11.GL_FLOAT, stridePlus, 3 * 4); glColorPointer(4, GL11.GL_FLOAT, stridePlus, (3 + 3) * 4); glTexCoordPointer(2, GL11.GL_FLOAT, stridePlus, (3 + 3 + 4) * 4); glVertexPointer(7, GL11.GL_FLOAT, stridePlus, (3 + 3 + 4 + 2) * 4); glDrawArrays(GL11.GL_TRIANGLES, 0, VPNCTEnd);
Then in my vertex shader I want:
//Get indices of bones //Get weights of bones //Get bone transforms //for each bone transform, apply it to gl_Position at the specified weight
What is the GLSL required for the last part of the process? It seems like I need to set a attribute pointer to the data somehow, but I'm not sure where to do that when the data is stored in the VBO.