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.
Multiple buffer aliases
The default framebuffer's set of 4 color images have certain aliases that represent multiple buffers. These names are GL_LEFT, GL_RIGHT, GL_FRONT, GL_BACK, and GL_FRONT_AND_BACK; they represent the left, right, front, back, or all four buffers. These are only allowed in glDrawBuffer (not glDrawBuffers; note the "s") and glReadBuffer.
When used for rendering outputs, multiple buffer aliases mean that all of the specified buffers get the same colors. When used for reading operations, the multiple buffer aliases specify a single buffer. The rule is that it specifies the frontmost, leftmost buffer of the ones that it covers. In tabular form:
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.
Pixel ownership test
If part or all of the OpenGL window is not visible on the screen, the non-visible pixels in the default framebuffer are said to no longer be owned by OpenGL. They fail the pixel ownership test.
Pixels that fail this test have undefined values. Any operations that attempt to change these pixel values may or may not succeed. Reading from unowned pixels may return anything.
Note that the pixel ownership test only matters for the default framebuffer. All Framebuffer Object pixels pass the pixel ownership test.
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 section 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. These are named GL_AUXi, where i is a number from 0 to the number of auxiliary buffers.
The default framebuffer can also contain an accumulation buffer, which can be used to perform certain computations when rendering.