I’m trying to stream a set of visualised data by drawing a line of circles from the left of the window and moving the previously drawn frame slightly to the right and drawing the line of circles again. Currently how I’m doing it is I’m drawing to an ofFbo while between fbo.begin() & fbo.end() and before I draw the line of circles at the left of the screen, I draw the fbo into itself with an offsetX.
fbo.begin();
// Draw the fbo into itself with an offset
fbo.draw(offsetX, 0);
// Draw the line of circles
ofColor col;
for (int i = 0; i < fbo.getHeight(); i++){
// Just setting the colours here for each circle
hue = ofMap(ofRandom(0, ofGetHeight()), 0, ofGetHeight(), 0, 255);
col.setHsb(hue, 255, 255);
col.a = alpha;
ofSetColor(col);
ofDrawCircle(0, i, 8);
}
fbo.end();
What I’m expecting is a scrolling stream of colour spots across the window like so (but all the way across the window):
A sample project can be found here: https://github.com/limzykenneth/test_FBO. I’ve digged around but couldn’t find why it’s happening or how to solve it so any help would be appreciated. Thanks!
Hmm…yours looks to be fine actually since it seems you are not getting glitchy spikes on the right edge.
I tried the example code you provided which works fine but not quite the effect I wanted which is the line of circles stay on the left edge while the drawn visuals themselves move.
It looks like it doesn’t happen to you with your screen shots - i.e. there is a clear vertical line between black and random colours. Can you confirm wether you see any visual tearing?
you are right. i was too quick with my post and forgot to add the NOT to my post. i correct that.
just to be clear, i did not need the reported problem.
sorry about the confusion.
I’ve just got something working on this branch. Basically this uses the readToPixels method of the fbo to read to an ofPixels object, use that as the ofPixels part of an ofImage and draw the image, instead of the fbo, in the fbo itself.