Hey
is there a way I can draw just one frame? I have tried calling ofSetBackgroundAuto(false) which is close but I only want draw to be called once and then pause. If I put my drawing code in setup() it does not seem to draw anything, and if i put a conditional around the drawing code in draw() it seems to get blatted with background regardless of what ofbClearBg() says …
#include "testApp.h"
bool drawn = false;
//--------------------------------------------------------------
void testApp::setup(){
ofEnableSmoothing();
ofBackground(255, 255, 255);
// cout << ofbClearBg() << endl;
ofSetBackgroundAuto(false);
// cout << ofbClearBg() << endl;
//
ofSetHexColor(0x000000FF);
ofNoFill();
ofEllipse(250, 150, 200, 200);
ofSetFrameRate(10);
drawn = false;
}
//--------------------------------------------------------------
void testApp::update(){
}
//--------------------------------------------------------------
void testApp::draw(){
if (drawn)
return;
float radius = 100;
int centX = 250;
int centY = 150;
ofSetColor(20, 50, 70);
radius = 10;
float x, y;
float lastx = -999;
float lasty = -999;
float radNoise = ofRandom(10);
for (float ang = 0; ang <= 360*4; ang += 5) {
radNoise += 0.05;
radius += 0.5;
float localradius = radius + (ofNoise(radNoise) * 200) - 100;
float rad = ofDegToRad(ang);
x = centX + (localradius * cos(rad));
y = centY + (localradius * sin(rad));
if (lastx > -999) {
ofLine(x, y, lastx, lasty);
}
lastx = x;
lasty = y;
}
drawn = true;
}