implement backbuffer class (solve flickering)