ofFbo scrolling produces visual tearing

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):

but what I get are some glitched artefacts like below (the “spikes” on the right should not be there, it should be flat):

While running it, it seem to have two lines where some shearing happens as marked by the red lines:

Also a video of it happening here.

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!

does NOT happen for me. see attached screen shots.

does this also create the same problem for you?

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.

@stephanschulz are you running on Windows, Mac or Linux?

I’ve just tested on my machine (MacBook Pro (Retina, 15-inch, Mid 2015, 10.11.6 (15G31)) and I get the same problem.

OSX 10.10.5
Xcode 6.4
OF 0.9.3
MacBook Pro 2.8 GHz Intel Core i7
NVIDIA GeForce GT 750M 2048 MB

Thanks stephan, looking back at your first reply:

does happen for me. see attached screen shots.

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.

fbo.readToPixels(pixels);
image.setFromPixels(pixels);
image.update();

fbo.begin();
    fbo.draw(offsetX, 0);
    texture.draw(offsetX, 0);
    image.draw(offsetX, 0);
        
    ofColor col;
    for (int i = 0; i < fbo.getHeight(); i++){
        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();

I haven’t tested the FPS yet but if this gives a better idea of what exactly is happening with the FBO that would be great.