pausing draw()/drawing one frame

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;  
}  
  
  

Why do you want to draw just one frame ? If your code doesn’t use a type of counter or timestamp you can make it so that it is always the same. In your example you can put the radNoise as a global variable (declared in testApp.h) and assign its value just once in setup. Then if you’d want another image you could change radNoise when an event like a keystroke or click occurs.

Doing one frame is mostly for testing out stuff, or if i have something generative that just renders its final output. The method you described is good enough though, thanks.