ofxAssimpModelLoader does not show colors

I’m importing an .obj model with a .mtl file. Precisely, this model http://www.graphics.cornell.edu/online/box/data.html

As I need to reposition all the meshes that compose the models and for each mesh I’ve to be able to query the global transformation matrix, I’ve converted each mesh that is in the ofxAssimpModelLoader in a of3DPrimitive, as I’ve described here Get global vertices position of an instance of ofxAssimpModelLoader

When I iterate through the faces of each mesh, face.hasColors() returns false, although the colors are in the .mtl file

I’ve changed the method:

of3dPrimitive MeshHelper::toPrimitive(const ofMesh& mesh) {
    of3dPrimitive primitive;
    primitive.getMesh().clear();
    primitive.getMesh().append(mesh);
    primitive.getMesh().enableNormals();
    return primitive;
}

to

of3dPrimitive MeshHelper::toPrimitive(const ofMesh& mesh) {
    of3dPrimitive primitive;
    primitive.getMesh().clear();
    primitive.getMesh().append(mesh);
    primitive.getMesh().enableColors();
    primitive.getMesh().enableNormals();
    return primitive;
}

But it is still returning false. I’ve also tried to put glDisable(GL_COLOR_MATERIAL);
like explained here Displaying material colors correctly without textures using Assimp in the draw method but it does not work.

I know this is an old topic, but I did not found in the forum any solution to this problem.

an mtl specifies the materials not colors per vertex, the assimp loader should also give you a list of materials per mesh

I see. Yes, materials are available in the ofxAssimpLoaderModel, I did not know it. Just a question, what is the way to go when you have a color set in the vertex of the mesh AND in a material? you blend both together or you decide which one to apply? I 'm asking because in the program that I’m writing I give precedence to the vertex color

ofFloatColor ofxRayTracer::getColor(const ofMeshFace &face, int indexMeshes) const {
    // vertex colors has precedence over material color
    if (face.hasColors()) {
        return face.getColor(1);
    } else if(materials.size() >= (indexMeshes+1) ) {
        return materials.at(indexMeshes).getDiffuseColor();
    } else {
        return ofFloatColor(1.f,1.f,1.f);
    };
}

But I’ve seen that three.js is blending them (the material takes as starting color the vertex color)

i don’t think it matters much, it’s probably something you have to decide based on how you plan to use it, if i remember well opengl 2 materials overrode color coordinates so OF does that too but if you want to use color coordinates mixed with materials then blending them is a better option