When I’m drawing on a Canvas, I use the createBufferStrategy(2) method to create two buffers. However I’ve seen multiple times other people creating three buffers and understand that many more can be used.
I can understand the need for two buffers but I cannot understand the logic behind using more.
My question is – what is the gain of using more than one buffer and how does that effect performance compared to two buffers?
Thanks in advance.
With double buffering, the front buffer is being displayed and the back buffer is being drawn in. Once the drawing is finished, but before the buffers are flipped, neither buffer can be touched. This could lead to a wait period during which no drawing can be done.
Triple buffering is a way to side-step the wait. There are two back buffers: once the drawing in one back buffer is complete, it can immediately start in the other back buffer.
Wikipedia has more details.