Need help understanding uv coordinates

I’m exporting a custom 3d format so I can use it in raylib, a library for making games. It has this mesh struct:

typedef struct Mesh {
    int vertexCount;        // Number of vertices stored in arrays
    int triangleCount;      // Number of triangles stored (indexed or not)

    // Vertex attributes data
    float *vertices;        // Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
    float *texcoords;       // Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
    float *texcoords2;      // Vertex second texture coordinates (useful for lightmaps) (shader-location = 5)
    float *normals;         // Vertex normals (XYZ - 3 components per vertex) (shader-location = 2)
    float *tangents;        // Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4)
    unsigned char *colors;      // Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
    unsigned short *indices;    // Vertex indices (in case vertex data comes indexed)

    // Animation vertex data
    float *animVertices;    // Animated vertex positions (after bones transformations)
    float *animNormals;     // Animated normals (after bones transformations)
    unsigned char *boneIds; // Vertex bone ids, max 255 bone ids, up to 4 bones influence by vertex (skinning)
    float *boneWeights;     // Vertex bone weight, up to 4 bones influence by vertex (skinning)

    // OpenGL identifiers
    unsigned int vaoId;     // OpenGL Vertex Array Object id
    unsigned int *vboId;    // OpenGL Vertex Buffer Objects id (default vertex data)
} Mesh;

So I’m just trying to fill these in.

I got the vertices and indices working, but I’m stuck on the texture coordinates. I’m trying to export them from blender like this:

for v in

but the texture doesn’t show right when i load it in the game.
The order that that texture coordinates are in in the array will change the way the texture looks, but I don’t know which order they are suppose to be in, and I don’t know which order my code is printing them in.

It also is giving more texture coordinates than vertices, and from the struct, I think I need one texture coordinate per vertex. I need help understanding this.

texture coordinates in Blender are per loop, not per vertex, so the number will rarely match up. Given that you will generally have three loops per vert (assuming triangles, no boundaries, no spit edges etc), it will usually be closer to three times the number of verts you can see. Imagine a cube- it has 6 faces and 8 vertices, right? it actually has 6*4 (24) loops, so 24 uv coordinates. Since there are only 8 vertices, there will be a lot of duplicates. This is how Blender handles uv “islands”, unfortunately…

for a better understanding of Blender’s geometry architecture, see this document. Once you read this doc and understand what’s going on with the Blender side of things you’ll have to extrapolate that information to your own format- I don’t know anything about raylib, but if it’s expecting an array of UVs that has the same number of indices as the vertex array, you’ll most likely need to create a lookup table of verts->uvs to build the UV array.

thanks, i read into loops more and understand it now