Basic graphics generation algorithm