grabScreen degradation over subsequent grabs

I’m trying to cache all vector drawing in an ofImage, so as to save on the amount of redrawing done each frame.

This snippet, which is a reworking of the ofxVectorGraphics sample app, works fine, except each grabscreen results in a gradually deteriorating buffer. All I’m doing is drawing the currently-being-drawn line over the top of my cached image, and when it is finished (the button is released), I just re-cache everything.

Is there something obvious I can do, so as to avoid this degradation in quality?


void testApp::draw(){  
	// Only draw the buffered   
	if(bufferImage.getPixels() != NULL) {  
		bufferImage.draw(0, 0);	  
	// draw the line being currently drawn  
	if( pts.size() > 0 ){  
		int numPts = pts.size()-1;  
		for(int i = 0; i < numPts; i++){  
			output.line(pts[i].x, pts[i].y, pts[i+1].x, pts[i+1].y);  
	// Only grab the screen when the line has been drawn  
	if (bLineFinished) {  
		bLineFinished = false;  
		// grabscreen as image buffer  
		bufferImage.grabScreen(0, 0, ofGetWidth(), ofGetHeight());	  
	// End capture!  
		capture =false;  

Is there a solution for this? I’m experiencing the same results in 0062 and Master.

EDIT: I had thought changing the saveImage quality would help but after commenting out saveImage it has no effect. This appears to be something with grabScreen. I will continue to dig…

it seems that you want to use an fbo. there’s going to be an ofFbo in 007 but with 0062 you can use any of the versions of ofxFboTexture in the forum

FBO wasn’t what I was looking for but, for now - I opted for ditching the transparency because it was no longer necessary for the application. Thanks!