Drawing an oscillator (very basic question)

I’m using OpenGL to draw an oscillator (sound waves - like in Audacity) for a sound editing program. The oscillator window has a width of 1000 px, so I’m drawing 1000 lines here. Also, a tracker line moves over the oscillator lines as the sound plays, so the window has to update at least 30x per second. However, I don’t want to redraw all 1000 lines on every frame as it eats away too much CPU and seems completely unnecessary to me; only the tracker line needs to be redrawn all the time. How should I go about this?

I know it’s a very basic question, but I couldn’t figure this out after doing the tutorials.
Any help is welcome!

Unless you want to render your lines to texture and use it as the background, you may just redraw the lines where the tracker was at the time of last frame and then draw the tracker line at the updated position. Make sure you use single-buffered window and do not clear it every frame to preserve the lines drawn.

Thank you; I tried that method before but I wasn’t aware that I was using double buffers all the time. This explains the flickering I had before.