Trouble simulating noLoop()

Hello there! I’m using OF has a static image generator. The setup I’d like to obtain is the one in which I draw everything on the first frame, and then do nothing.

To try and simulate so, in my setup function I just set ofSetBackgroundAuto(false) and just after a gray background with ofBackground(128). Then, in my draw function I just have the following:

if (ofGetFrameNum() == 0) {
    ofDrawRectangle(42, 42, 42, 42);

However, it does not draw anything on the screen. I can’t really understand why. I’m also trying to use an ofFbo but I’m curious to understand if it is possible also in the way I’m proposing.

Edit: using a ofFbo instance, writing on it and then drawing it works flawlessly!


It’s probably because you’re drawing the rectangle only once at frame 0. After that the canvas refreshes, the background gets redrawn, and you’re previously drawn stuff thus “wiped”.

You can try to turn auto-background redrawing off (i.e. ofSetBackgroundAuto(false)) in ofApp::setup(). This should fix the issue.

Hello there! Thanks for your suggestion but I’m already doing that. As I write in the first post, in the setup function I have what you suggest.

Can you post your code?