I have a function in my ofApp which loads some stuff from disk, and performs some initializations. In doing so, it completely hogs the default draw()
method for about 5-10 second, which I've confirmed with:
void ofApp::draw() {
ofLogNotice() << " draw! ";
...
}
Basically, no message is output during while initialization function does its stuff and hogs the rest.
I am aware that this should probably be solved somehow using threads, but for now, I'd just like to draw a line on screen, to indicate something is happening. Initially I would have added an ofDrawLine
in the draw()
method, but since it doesn't run while hogging, it doesn't help me with much. So, I thought of inserting ofDrawLine
directly in my function that inits (and hogs):
void ofApp::LoadAndInit() {
ofSetColor(ofColor::green);
ofSetLineWidth(3);
ofDrawLine(50, 50, -50, -50); // start indication
// do hog stuff part 1
ofDrawLine(60, 60, -60, -60);
// do hog stuff part 2
....
}
I would have expected the lines to overlap with the last rendered image (as the full draw()
is not called, and the rendering process would not clear the window) - however, I am not having anything shown at all.
Is there anything I could do (maybe call some function), so that the ofDrawLine
is forced to draw from this function - regardless if it is not called from the actual draw()
? I tried using events().notifyDraw();
after the ofDrawLine
, but unfortunately I still cannot see any of these lines drawn...