Hi,
I’m attempting to create a trail effect in ofxCv with ofFbo and I think I’m nearly there but I’m struggling with the order of things and also my program ends up crashing atm.
I’ve taken the contour and created an ofPath from it and now I’m attempting to turn it into a mesh and add a trailing effect with Fbo so that a trail of pixels is left when the user moves and gradually fades.
I am able to leave a trail by setting the colour of ofPath but I’m unable to pass in the texture from the video
This is my current code:
I’m quite new to oF so I think I’m making some mistakes with the order of things and efficiency, I’d appreciate any guidance.
Thanks!
rgbaFboFloat.begin();
int n = contourFinder.size(); //number of contours found
for(int i = 0; i < n; i++) {
polyline = contourFinder.getPolyline(i); //get a polyline of every contour
path; //to convert
for( int i = 0; i < polyline.getVertices().size(); i++) {
path.lineTo(polyline.getVertices()[i]);
}
path.close();
path.simplify();
// ofSetColor(255, 100);
// path.draw();
mesh = path.getTessellation(); //tessellation only represents the fill of our shape
for (int i = 0; i<mesh.getNumVertices(); i++){
mesh.addTexCoord(mesh.getVertex(i));
texture.bind();
mesh.draw();
texture.unbind();
}
}
}
rgbaFboFloat.end();
}