Questions about multiple Primitives per Mesh in glTF file


#1

I am developing a small app using OpenGL ES and the glTF reference loader library (c#) on a Xamarin Android based Visual Studio project.

Right now, I am trying to build my own class structure for organizing the models’ data. I read the specs, and the skinning tutorial was very helpful, but now I have a question concerning the meshes and skins array:

Question 1:

{
        "name" : "Untitled",
        "primitives" : [
            {
                "attributes" : {
                    "JOINTS_0" : 99,
                    "NORMAL" : 96,
                    "POSITION" : 95,
                    "TANGENT" : 97,
                    "TEXCOORD_0" : 98,
                    "WEIGHTS_0" : 100
                },
                "indices" : 94,
                "material" : 2
            },
            {
                "attributes" : {
                    "JOINTS_0" : 106,
                    "NORMAL" : 103,
                    "POSITION" : 102,
                    "TANGENT" : 104,
                    "TEXCOORD_0" : 105,
                    "WEIGHTS_0" : 107
                },
                "indices" : 101,
                "material" : 11
            }
        ]
}

This example shows an item from the Mesh array which obviously consists of two primitives. I suppose, that is because some of the vertices have other properties than others?!
However, how may I deal with this case:
Do I create VBOs and a VAO for each Primitive of the Mesh item? Can I just create a big array and pass all the Primitives’ data to it (all the meshes are definitely made out of regular triangles)?

Question 2:

{
                "attributes" : {
                    "JOINTS_0" : 63,
                    "JOINTS_1" : 65,
                    "NORMAL" : 59,
                    "POSITION" : 58,
                    "TANGENT" : 60,
                    "TEXCOORD_0" : 61,
                    "TEXCOORD_1" : 62,
                    "WEIGHTS_0" : 64,
                    "WEIGHTS_1" : 66
                },
                "indices" : 57,
                "material" : 8
}

Can I just concatenate Primitives’ JOINTS_0 and JOINTS_1 attributes into one big VBO or is there something else I need to consider?

Question 3:

This is an excerpt of the model’s Skin section:

"skins" : [
    {
        "inverseBindMatrices" : 115,
        "joints" : [
            6,
            7,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            17,
            18,
            19,
            20,
            21,
            22,
            23,
            24,
            25,
            26,
            27,
            28,
            29,
            30,
            31,
            32,
            33,
            34,
            35,
            36,
            37,
            38,
            39,
            40,
            41,
            42,
            43,
            44,
            45,
            46
        ],
        "skeleton" : 0
    },

The whole model has 5 Meshes (with multiple Primitives) and several bones/joints. However the item count of Skins in the glTF file is way higher than 5! How can this be?! I thought that for each Mesh that is controlled by an armature, there is a Skin? Why are there so many more than 5? Is it because of the multiple primitives? If yes, then why are there so many inverseBindMatrices?! There should be only 5, right?
I am confused: What shall I import for “Meshes” when I have a rigged and animated glTF file: the Meshes array or the Skins array?

It seems to me that there are many pitfalls for a newbie like me. The tutorials are a good starting point, but the examples shown there are so minimalistic, that everything is easy. However, real world models taken from any website are far more complicated than this.

Maybe someone can help me out?

Cheers,
Lutz

P.S.: I can send the gltf file I am talking about if this is helpful for answering my questions. Unfortunately I cannot post any links here.