How do double buffering and page flipping prevent tearing?

In this blog post, we explore the principles and operation of graphics technology designed to solve screen tearing.

 

The Principle of Video

The world flows continuously, but recordings cannot capture all that continuity. Therefore, when a video camera records footage, it captures and displays approximately 24 images per second (these images are called frames). The fundamental principle of video is rapidly displaying these 24 captured images per second.

 

The History and Development of Animation Technology

Animation technology is growing in importance not only in video but also in the field of computer graphics. Initially, simple frame-based animation dominated, but as technology advanced, there was a growing demand for more complex and natural movement. Against this backdrop, the development of computer graphics has become crucial across various industries like gaming, film, and virtual reality. Particularly, situations requiring high-resolution displays and high frame rates necessitated faster and more efficient methods.
Animation in computer graphics operates on a similar principle. However, unlike frames captured from video, which contain motion in each frame, frames in computer-generated animation are completely static images. This difference is easily understood by comparing a paused video frame with a captured scene from a running game. When a video is paused, the image appears blurry because the video frame contains motion information from the frames in between.

 

Why More Frames Are Needed

Computer animation requires more frames than video to achieve natural movement. Typically, computer graphics require at least 60 frames per second for natural animation. Since each frame must be drawn in under 16ms, optimizing the screen update speed becomes a critical challenge.
When early computer animation emerged, monitors operated by directly updating the screen being viewed. While this method was simple to implement, it suffered from the problem of incomplete frames being displayed on screen while they were being drawn. The technology developed to solve this problem is ‘double buffering’.

 

Concept and Principle of Double Buffering

A ‘buffer’ is a memory area used to output the screen to the monitor. Double buffering employs two buffers: one prepares the frame to be displayed on the screen, while the other prepares the next frame. This method resolves the issue of incomplete frames appearing on the screen.
Traditional double buffering methods involved copying the frame drawn in the back buffer to the front buffer. However, as monitor resolutions increased, copy times grew longer, leading to efficiency issues. Consequently, a new method for faster switching became necessary.

 

Page Flipping and Performance Improvement

Page flipping is a form of double buffering that alternates the roles of the back buffer and front buffer. Specifically, the back buffer becomes the front buffer for the next frame, and vice versa. This process is extremely fast because it involves only a role swap, not a copy.
However, this method has drawbacks. If the buffer swap occurs while the monitor is updating the screen, it can cause ‘tearing’ – a phenomenon where the screen appears split. This typically happens when the buffer swap occurs while the monitor is sequentially reading data.

 

V-Sync and Vertical Synchronization

The technology developed to solve tearing is ‘vertical synchronization (V-sync)’. V-sync prevents tearing by only switching buffers during the monitor’s vertical blanking interval, when the screen is not being refreshed. This method effectively resolves tearing by synchronizing the buffer switch timing with the monitor’s refresh cycle.
These advances in graphics technology have been applied across various fields, including high-performance gaming, 3D animation, and real-time rendering. They are becoming increasingly crucial, especially for next-generation interfaces like virtual reality (VR) and augmented reality (AR), where higher frame rates and smoother graphic transitions are essential.

 

Triple Buffering and the Challenges of Modern Animation

Recently, a technology called ‘triple buffering’ has emerged beyond double buffering. This method, utilizing three buffers, enables greater data processing, simultaneously enhancing animation smoothness and performance. It is particularly advantageous for overcoming performance degradation issues in high-spec graphics tasks or real-time rendering.
This technology is essential for achieving natural graphics and has become a major research topic in computer science, aimed at providing faster frame transitions and optimal animation quality.

 

Conclusion: The Future of Computer Graphics Technology

Computer graphics technology has become an essential element not only in animation but across various digital media. Double buffering is just the beginning; new buffering techniques offering even greater performance will continue to be developed. This will enable more immersive graphical experiences and high-performance animation. The advancement of computer graphics continues, and as technologies for processing more frames faster become reality, the future of animation will grow ever brighter.

 

About the author

Writer

I'm a "Cat Detective" I help reunite lost cats with their families.
I recharge over a cup of café latte, enjoy walking and traveling, and expand my thoughts through writing. By observing the world closely and following my intellectual curiosity as a blog writer, I hope my words can offer help and comfort to others.