How to loopOnce

#1

Hey,

So I want my sketch to only call the draw function once but there doesn’t seem to be a way to do this that I can find, I found the drawOnce() function in the docu but it doesn’t seem to work anywhere in my code.

Many thanks

#2
ofApp::draw()
{
   // do stuff
    ofExit();
}
#3

Also possible without exiting the app.

ofApp::setup(){
    ofSetBackgroundAuto(false);
}

ofApp::draw(){
    if(ofGetFrameNum() == 0){
        //draw code here.
    } else {
        //do nothing.
    }
}
1 Like