Saving motion of spline, playing afterwards (ofBeginShape)

Hi @ all,

i am struggling since hours with the problem, that i cannot correctly draw saved contours. I am capturing from the webcam the motion, i am saving them all in a

list<list>

and than drawing it with ofBeginShape()

I don’t know what i am doing wrong :frowning:

The draw function

  
void vectorVideo::draw(list<list<ofPoint>>& vectorFrame){  
				  
				  
	for (list<list<ofPoint>>::iterator it = vectorFrame.begin(); it != vectorFrame.end(); ++it){  
					  
		//check that   
		if(fpsControl.clockUpdate()){  
				ofSetColor(0x0cb0b6);  
				ofSetPolyMode(OF_POLY_WINDING_POSITIVE);  
				ofBeginShape();  
							  
				//loop through the actual list of points  
				for(list<ofPoint>::iterator it2 = (*it).begin(); it2 != (*it).end(); ++it2){  
				ofVertex((*it2).x, (*it2).y);  
				}  
  
				ofEndShape();  
		}  
		else{  
			--it;  
			}  
	}  
			  
}  

So far i think, that the problem is caused by the code above. If you don’t think so, i’ve also attached a rar file.

Would be nice if someone could gaze at my code or give me some tipps.

thanks

src.rar

…allright i think that he is just drawing the last bunge of points…weired…

Allright guys,

now i did really dirty coding, but you can see here now better what i am doing. The problem is caused by the for loop, i have in my list<list> many blobs saved, but he is only drawing the last one, he is just skipping to draw.

  
if(contourFinder.blobs.size() >= 1){  
			    //contourFinder.blobs[0].draw(0,0);  
				for(int j = contourFinder.blobs[0].pts.size()-SMOOTHING; j >= 0; j-=SMOOTHING){  
					objectShape.push_back(ofPoint(contourFinder.blobs[0].pts[j].x, contourFinder.blobs[0].pts[j].y));  
					colorImg.drawBlobIntoMe(contourFinder.blobs[0], 22);  
				}  
				  
				positionSequence.push_back(objectShape);  
				objectShape.clear();  
  
		 }  
				  
		int counter = 0;	  
		else if(contourFinder.blobs.size() <= 0 && !positionSequence.empty()){  
					//actor.record(positionSequence, positionSequence.size());  
			for (list<list<ofPoint>>::iterator it = positionSequence.begin(); it != positionSequence.end(); it++){  
					ofSetColor(0x0cb0b6);  
					ofSetPolyMode(OF_POLY_WINDING_POSITIVE);  
					ofBeginShape();  
					  
						for(list<ofPoint>::iterator it2 = (*it).begin(); it2 != (*it).end(); ++it2){   
							ofVertex((*it2).x, (*it2).y);   
							counter++;  
					}  
				ofEndShape();  
			}  
			positionSequence.clear();  
		}  

would be nice if someone could help me out

allright, i think i now know the problem. i was calling a function in the “testApp”

actor.record(positionSequence, positionSequence.size());

which was calling a draw function, looping through my list<list> but while he was drawing, the app was freezing, and then he just was showing the last list of Points. Therefore i think, he could not update the screen.

Now i m incrementing within the " testApp::draw " my iterator, its working…i will no go refactoring…

thanks for your time :wink: