Skip to content

Instantly share code, notes, and snippets.

@unohee
Last active May 2, 2016 23:47
Show Gist options
  • Select an option

  • Save unohee/ff6e0fad584fa86164841456094c17e2 to your computer and use it in GitHub Desktop.

Select an option

Save unohee/ff6e0fad584fa86164841456094c17e2 to your computer and use it in GitHub Desktop.
mesh snippets for Infinite Machine
void ofApp::update(){
//Test Drawing
if(bEuclid == true){//when sequencer triggers.
//add vertex values randomly.
for(int i=0; i < seq_len;i++){
verts[i] = ofPoint (ofRandom(0, ofGetWidth()/2), ofRandom(0, ofGetHeight()/2),ofRandom(-25,25));
mesh.addVertices(verts);
mesh.addTriangle(3, 2, 0);
mesh.addTriangle(3, 1, 2);
mesh.addTriangle(3, 0, 1);
mesh.addColor(ofFloatColor(ofRandom(0,0.2),ofRandom(0,1),ofRandom(0,1)));
}
}
mesh.setupIndicesAuto();
}
void ofApp::draw(){
if(start){//when play button toggles
glTranslated(ofGetWidth()/4, ofGetHeight()/4, 0);
mesh.draw();//draw mesh
}else{
mesh.clear();//if not. it doesn't draw
}
if(bEuclid == 0){
//when trigger is zero or it doesn't started
mesh.clear(); //clear mesh.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment