In computer graphics, triple buffering is a variant on double buffering, a technique for drawing graphics
that show no (or less) flicker, shearing, and tearing artifacts.
Triple buffering attempts to provide a speed improvement over double buffering. In real life
applications, this often involves trying to abstract the graphics drawing operations from being
synchronized with the monitor's refresh rate. Typically this involves frames being drawn at a rate lower
than or higher than the monitor's frame rate (a variable frame rate) without the usual effects this would
cause (namely flickering, shearing and tearing).
Due to the software algorithm not having to poll the graphics hardware for monitor refresh events, the
algorithm is free to run as fast as possible. This is not the only method of triple buffering available, but
is the most prevalent on the PC architecture where the speed of the target machine is highly variable.
Another method of triple buffering involves synchronising with the monitor frame rate, and simply using
the third buffer as a method of providing breathing room for changing demands in the amount of
graphics drawn. This is the use of a buffer in the true sense whereby the buffer acts as a reservior.
Such a method requires a higher minimum specification of the target hardware but provides a
consistent (vs. variable) frame rate.
Triple buffering implies three buffers, but the method can be extended to as many buffers as is
practical for the application. Usually, there is no advantage to using more than three buffers.
Limitations of double buffering
If the system has two color buffers A and B, it can display buffer B while drawing a new picture
(rendering) into buffer A. When it is done rendering into buffer A, the system needs to wait until buffer
B is in the monitor's vertical blank period before swapping buffers. This waiting period could be several
milliseconds (an eternity to a computer) during which neither buffer can be touched. When the monitor
is in vertical blank it can either swap buffers A and B and then start rendering into buffer B (page
flipping) or copy buffer A into buffer B and render into buffer A.
Advantage of triple buffering
If the system has three color buffers A, B and C, it does not have to wait to swap buffers. It can display
buffer B while rendering into buffer A. When done rendering into buffer A, it can start rendering into
buffer C immediately. When the monitor is in vertical blank, it can display buffer A and make buffer B
available for reuse.
Limitations of triple buffering
If the system always renders buffers in less time than it takes to display a buffer once on the monitor,
the computer will wait for the monitor regardless of how many buffers there are. In this particular case
triple buffering has no advantage over double buffering.