Hello,
I was trying to use the “postFragment” feature of ofMaterialSettings but it doesn’t seem to work.
I’ve included part of my code that should color my “cubes” red, but they are more of greenish.
Maybe the shader has to be updated or compiled someway after I set the string, but I
can’t find how.
I only post here because I haven’t found any example or documentation of this way of
insert shader-code (and I have spent a good couple of hours searching and testing things).
/Ola
edit: I’m on oF 0.10.1
ofMaterial* getMat(string s) {
int ii = model.getAssimpScene()->mRootNode->FindNode(s.c_str())->mMeshes[0];
return &model.getMeshHelper(ii).material;
}
void ofApp::setup(){
model.loadModel("cubes.fbx");
ofMaterial* s = getMat("Box002");
s->setDiffuseColor(ofFloatColor(0.0, 0.9, 0.1));
s->getSettings().postFragment = STRINGIFY(
vec4 postFragment(vec4 localColor) {
return vec4(1.0, 0.0, 0.0, 1.0);
}
);
.
.
.
}