The Default Framebuffer is the framebuffer that OpenGL is created with. It is created along with the OpenGL Context. Like Framebuffer Objects, the default framebuffer is a series of images. Unlike FBOs, one of these images usually represents what you actually see on some part of your screen.
The default framebuffer is created at the time the OpenGL context is constructed. The desired properties of the default framebuffer are given to the context creation functions, which will take these into consideration when creating the context. The construction of a context is platform-specific, so exactly how you specify your desired properties is platform-specific.
The default framebuffer contains a number of images, based on how it was created. All default framebuffer images are automatically resized to the size of the output window, as it is resized.
The default framebuffer contains up to 4 color buffers, named GL_FRONT_LEFT, GL_BACK_LEFT, GL_FRONT_RIGHT, and GL_BACK_RIGHT. The left and right buffers are used for stereoscopic rendering. Most consumer graphics cards cannot use these for doing stereoscopic 3D visualization.
If stereo rendering is not being done, then only the left buffers will be active. Attempts to read from or draw to the right buffers would fail. Without stereo, one can also use GL_FRONT and GL_BACK as aliases for GL_FRONT_LEFT and GL_BACK_LEFT.
The front and back buffers represent a double-buffered framebuffer. The front buffer is, more or less, what you see on the screen. The back buffer is the image that is typically rendered to. When the user wants the rendered image to become visible, they call a platform-specific buffer swapping command. This effectively transfers the back buffer data into the front buffer.
Rendering into, or reading from, the front buffer is not advisable.
The buffer swap does not have to be a true swap. In a true swap, the back buffer becomes the front buffer and vice-versa. If you were to read from the back buffer after a true swap, it would hold the previous contents of the front buffer.
That being said, OpenGL does not require true swapping. All that is required is that the contents of the back buffer find their way into the front buffer. This could be via a true swap, or it could be via a copy from the back buffer into the front.
Stereo rendering has two back buffers and two front buffers. Swapping performs the switch on both.
The default framebuffer can have a Depth Buffer, which can be used for depth testing. The precision of the depth buffer is generally one of the parameters passed to the context creation functions.
Stereo rendering still uses one depth buffer. It must be shared among the left and right buffers, so a clear may need to be issued between rendering to the left and right buffers.
The default framebuffer can have a stencil buffer for doing stencil tests. The number of stencil bits is generally one of the parameters passed to context creation functions.
Stereo rendering still uses one stencil buffer. It must be shared among the left and right buffers, so a clear may need to be issued between rendering to the left and right buffers.
The default framebuffer can be multisampled as well. Again, the number of samples is usually specified as a context creation parameter.
Removed buffer images
|Warning: This article describes legacy OpenGL APIs that have been removed from core OpenGL 3.1 and above (they are only deprecated in OpenGL 3.0). It is recommended that you not use this functionality in your programs.|
In compatibility contexts or OpenGL 3.0 and below, the default framebuffer can contain a plethora of other image buffers. It can contain a number of auxiliary color images; these are simply off-screen color buffers of the same size as the window. They can be rendered to and blitted from just like any other image.
The default framebuffer can also contain an accumulation buffer, which can be used to perform certain computations when rendering.