Nope, it is still not working, I've a bad memory access. I've simplified and pushed the code, removing the part with the L-System grammar that is not the problem.
void ofApp::setup(){
mesh.setMode(OF_PRIMITIVE_POINTS);
mesh.enableColors();
auto joinBranch = ofNode();
auto oldBranch = ofNode();
auto newBranch = ofNode();
oldBranch.setPosition(150, 700, 0);
oldBranch.move(ofVec3f(0, -100, 0));
mesh.addVertex(oldBranch.getGlobalPosition());
mesh.addColor(ofFloatColor(1.0, 0.0, 0.0));
for(int i = 0; i < 4; i++){
joinBranch = ofNode();
joinBranch.setParent(oldBranch);
joinBranch.roll(25.0);
newBranch = ofNode();
newBranch.setParent(joinBranch);
newBranch.move(0, -100.0, 0);
mesh.addVertex(newBranch.getGlobalPosition());
mesh.addColor(ofFloatColor(1.0, 0.0, 0.0));
//reassign oldBranch value
oldBranch = newBranch;
}
}
void ofApp::draw(){
ofBackground(0);
mesh.draw();
}
I do not need to keep the jointBranch
in a vector, because what i need are just the points in the mesh.