Yes, this is how a "paint" program should be implemented.

The contents of the default framebuffer aren't guaranteed to persist from one frame to the next. The contents of the back buffer are...