Double Buffer (Double buffering) is a widely used technique where you draw all your graphic needs to an image stored in the memory (called buffer). After drawing needs, you have to draw a complete image from the memory to the screen. So, we can define it as a form of buffering where two buffers are used. For output, the program fills one buffer while the device empties the other then the buffers exchange roles. Same technique is used for input. In computer graphics, the switching between two or more frame buffers is to allow picture composition to be performed with display simultaneously. The double buffering concept is worked out in C-language.
To understand this, we are taking an easy example of a Progress Bar that has many layers.
1) Border layer
2) Background layer
3) Percent layer
4) Progress layer
In this, for each layer, you have to call some drawing operation and the control redraws itself to the screen after each drawing operation. If the refresh rate is low you will have no any problem but if you speed up the refresh rate then blinking or flickering occurs.
You can solve this problem by drawing all the layers to an image which is located in the memory and after drawing all the layers into this image you can draw the image onto the screen. This will dramatically improve the performance.
Advantages of Double buffering
Let’s see why you want to use double-buffering over single buffering in games, your GUI or video displays?
The main advantages of double-buffering are:
- It is essential in real time data acquisition, complex and analysis systems.
- To create smooth flowing graphics
- To speed up a computer that can overlap I/O with processing
- Required primarily to eliminate visible draws that can make an application look sluggish, amateurish or appear to flicker
- User does not see every pixel modification so if the same pixel gets modified 10 times, then even the user will only see the last one. This helps preventing flickering
- It usually takes care of artifacts you or the user might be experiencing.
- Writing to video memory needs to be performed once on the buffer swap, instead of repeatedly for every pixel of which some might be invisible and might be overlapped later.
Disadvantages of Double buffering
On one side, double-buffering is useful but on the other side it also has disadvantage. Each one is listed with an explanation and a possible solution.
Now, at last we will discuss one thing more that in computer science, the situation of having a running tap that should not be turned off is common like a stream of audio. In this kind of situations, double buffering is employed.

















