extract framebuffer programme functionality to separate template