Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

ofxAssimpModelLoader does not show colors

$
0
0

@edapx wrote:

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 https://forum.openframeworks.cc/t/get-global-vertices-position-of-an-instance-of-ofxassimpmodelloader/27433/5?u=edapx

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 https://forum.openframeworks.cc/t/displaying-material-colors-correctly-without-textures-using-assimp/8708/5 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.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles