Vertex skinning, calculating the bone matrices (for bind pose) and then animating them

I am attempting to do HW skinning in Opengl. Please note that I am purposefully doing it in a not-game ready optimized way, because I need this to scale. I wrote the following code to ‘apply’ the skinning:

  mat4 BoneXForm;    for (int i = 0; i < maximumInfluence; i++) {     BoneXForm += globalAnimMats[blendWeights[i * gl_VertexID].blendId] * blendWeights[i * gl_VertexID].blendValue;   }    vec4 VertPoseLong = BoneXForm * vec4(vertPos, 1.0);    // Set the vertex postion   gl_Position = MVP * VertPoseLong; 

This code uses ‘globalAnimMats’ a mat4 x bones, and an array of skinning indices/value combos:

struct { int BoneIndex; float Influence; }; 

My issue is, I am not sure what the value of each matrix should be in the matrix buffer. Per each bone on the CPU, I have local space pos/rot and global space pos/rot. My goal here is so also apply an animation to the skeleton.

The position is a vec3 and the rotation is a quat. I have tried doing global pos/rot as a mat4 but the whole model moves above the skeleton.