ofDrawXXXX per loop leaves left over of it?

Hello dear community,

I was trying to understand that,

     float x = ofRandomuf() * ofGetWidth();
     float y = ofRandomuf() * ofGetHeight();
     float x2 = ofRandomuf() * ofGetWidth();
     float y2 = ofRandomuf() * ofGetHeight();

will actually draw only one line on a random position at every new frame, hence only one line in every new frame, but I was able to see multiple random lines.
Still not sure if it’s a sort of optical illusion, but if I slow it down by using,


I could confirm that I’ve seen only one line at every time.

Is there any reason for it?
I suspect that my screen(Macbook pro built-in screen) might remember the previously drawn lines, but I want to be sure about it…

Thanks in advance!

You Mac’s screen probably isn’t remembering previously drawn lines, but your eyes and brain might be. Have a look at “persistence of vision” to see if it describes your observations.

Hello @TimChi

Thanks for the answer!
I’m glad that you gave me this term, “persistence of vision”.
I could found some interesting facts after doing some search with this.

Although my main suspect was whether the openframeworks(or the opengl) is drawing multiple lines into a single frame.

I would really love to dig into the source code, and want to understand the technical side, but I sadly would need to learn way more about c++ and opengl for it.

But big thanks to your input!

Hey @oudeis there are some great web sites out there for learning all kinds of programming stuff, including c++ and openGL. And you can learn a lot by studying the projects in the oF /examples folder. Also, definitely look at code for the different oF classes! The core developers (often) do a fantastic job of writing comments in the header files, which makes them easier to follow I think. And then the code is written in a way that feels intuitive and consistent, with relatively few macros or other murky abstractions. Its fun to create a project and try out some functions in a class, and then go into the source code to see what’s happening inside the class when those functions are called.