Heuristic42
Blog
Opengl
Meta
Rendering
1
comment
Apr 19 at 11:24
Matrices
Please have whoever is in charge of the business call me at the…
–
anonymous
comment
Apr 13 at 0:25
Matrices
Hey there! Looking to save on energy costs? Look no further! …
–
anonymous
comment
Apr 5 at 9:43
Matrices
If you look closely in the Bible, there are very specific warni…
–
anonymous
comment
Mar 27 at 17:19
Matrices
Are you still in business? heuristic42.com
–
anonymous
comment
Mar 25 at 4:59
Matrices
Hey There I tried calling your phone number but it was unsuc…
–
anonymous
comment
Mar 5 at 15:39
Matrices
Hi, I hope this message finds you well. I'm reaching out to …
–
anonymous
comment
Feb 7 at 5:45
Microsoft Natural Ergonomic 4000 Replacement
Thank you so much for sharing your thoughts here, it tells me e…
–
anonymous
comment
Jan 28 at 23:31
Microsoft Natural Ergonomic 4000 Replacement
Oh man, I feel this post. Not sure if you've seen the "new" new…
–
anonymous
comment
Jan 25 at 12:06
Matrices
Hi, Mark here. If it is ok for your business processes to be…
–
anonymous
comment
Jan 20 at 3:11
Matrices
[deleted]
–
anonymous
reverted
Dec 21 '23
Route contention when running docker and a VPN
updating to latest
–
admin
edited
Dec 21 '23
Route contention when running docker and a VPN
Things have improved since the original post. It may have been …
–
pknowles
edited
Dec 21 '23
Route contention when running docker and a VPN
Things have improved since the original post. It may have been …
–
anonymous
edited
Dec 21 '23
Route contention when running docker and a VPN
This have improved since the original post. It may have been up…
–
anonymous
comment
Nov 24 '23
Matrices
[deleted]
–
anonymous
edited
Sep 17 '23
Writing custom C++ containers, iterators and value references
Generic containers are awesome. 1. The effort required to wr…
–
pknowles
created
Sep 17 '23
Writing custom C++ containers, iterators and value references
Generic containers are awesome. 1. The effort required to wr…
–
pknowles
comment
Sep 15 '23
DerBard: Custom Split Mechanical Keyboard Prototype
Hey. Thanks for your interest! I've uploaded the files here, bu…
–
pknowles
comment
Sep 13 '23
DerBard: Custom Split Mechanical Keyboard Prototype
Hi! Is it possible to get some models so I can also make it?
–
anonymous
edited
Aug 14 '23
On docker stealing routes and breaking the internet
Boy this is frustrating. The internet just doesn't work with do…
–
pknowles
edited
Aug 14 '23
On docker stealing routes and breaking the internet
Boy this is frustrating. The internet just doesn't work with do…
–
pknowles
created
Aug 14 '23
On docker stealing routes and breaking the internet
Boy this is frustrating. The internet just doesn't work with do…
–
pknowles
comment
Jul 13 '23
Matrices
[deleted]
–
anonymous
comment
Jul 6 '23
Matrices
[deleted]
–
anonymous
…
View All
Log in
The Framebuffer
leave this field blank to prove your humanity
Slug
*
A URL path component
Parent page
<root>
3D Rendering (Computer Graphics)
--- Cameras
--- Matrices
------ Projection Matrix
--- Vectors
--- 3D Geometry
------ triangle_meshes
--- Shading
------ Transparency and Alpha Blending
--- Lights
--- rasterization
------ Deep Image
--- Shadows
--- Vector Spaces
------ Tangent Space
------ Clip Space
--- rotations
--- images
------ mipmapping
--- materials
OpenGL Tutorials
--- Order Independent Transparency (OIT)
--- The Framebuffer
Pages About This Site
--- Contributing
--- Bugs
--- Why does this website exist?
The parent page this belongs to.
Article title
*
Article revisions must have a non-empty title
Article body
*
A frame is one rendered image in an animated sequence. A common measurement of animation smoothness or speed is frames per second (FPS). A buffer is a block of memory used as temporary storage while moving and processing data. GPUs use many buffers internally, but a well known one is the *framebuffer*, which buffers each frame as it's rendered. It simply stores pixel data, like an image, but holds the partial state and intermediate values during the rendering process. For example blending may continually update certain pixels as more geometry is rendered. A *deep framebuffer*, with ties to G-buffers in deferred shading[^DWS+88][^ST90], is typically implied by just “framebuffer” and stores many attributes per pixel. For example depth as well as RGBA colour. This may also be considered a collection of image buffers, one per attribute, which are grouped to form the deep framebuffer. Note that this is different to a [*deep image*](https://www.heuristic42.com/22/), such as a *deep G-buffer*[^MMNL14]. When creating an OpenGL context, the application typically requests a "default" framebuffer, with RGBA colour and depth for example. This holds the final image that ends up shown on the screen. The framebuffer is continually updated as geometry is rendered. If shown directly, the updates would appear as flickering. Geometry that should be occluded may briefly be visible during the render. To avoid this, rendering is performed off-screen to a hidden *back* framebuffer. When a frame is ready, the back framebuffer is swapped with the *front* framebuffer to show only the final results all at once. This is called *double buffering*. The back framebuffer allows off-screen rendering in one sense, but often two or more images need to be rendered and then combined to form the final result; or one is a pre-requisite for another, such as a dynamic texture. There are other fixed framebuffers that allow this, but most are deprecated and superseded by framebuffer objects. # Framebuffer Objects Framebuffer objects (FBOs) allow off-screen rendering, render-to-texture and creating many different configurations of deep framebuffers. A primary example is rendering a [shadow map](/17/rendering/shadows/#shadow-maps). The scene is first rendered to a depth texture from the point of view of a light (1024×1024 for example). During the main 1920×1080 rendering recording RGB colour, the depth texture can be used to determine which fragments are in shadow. Different resolutions and pixel attributes are used to emphasize different FBO configurations, discussed next. An FBO doesn't actually store any image data by itself. It serves as a hub for connecting *attachments*, the actual buffer memory. Attachments can store colour, depth and stencil results from rendering. Although called colour by OpenGL, you can really store whatever data you want. The attachments themselves can be textures, render buffers, pixel buffers, buffer objects via texture buffers etc. They can also be 1D, 2D, 3D, array textures, cube maps, levels of the above and mipmaps. Example usage is as follows: int fbohandle; // allocate an empty framebuffer and get a handle to it glGenFramebuffers(1, &fbohandle); // from now on, I'm modifying the FBO fbohandle glBindFramebuffer(GL_FRAMEBUFFER, fbohandle); // attach a texture to store colour when rendering int texture = createTexture(...); glFramebufferTexture2D( GL_FRAMEBUFFER, //target. i.e. fbohandle from glBindFramebuffer GL_COLOR_ATTACHMENT0, //attachment GL_TEXTURE_2D, //texture target texture, //texture ID 0 //mipmap level ); // zero the uninitialized texture glClear(GL_COLOR_BUFFER_BIT); // adjust the viewport to match the texture size glViewport(...); // render to the texture drawScene(); // go back to rendering to the default framebuffer glBindFramebuffer(GL_FRAMEBUFFER, 0); glViewport(...); A handy function is `glBlitFramebuffer`, which is a very fast way to copy between framebuffers and convenient to view the results of off-screen renders, such as the above, without setting up further rendering passes. glBindFramebuffer(GL_READ_FRAMEBUFFER, fbohandle); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glBlitFramebuffer(x0, y0, w0, h0, x1, y1, w1, h1, GL_COLOR_BUFFER_BIT, GL_NEAREST); glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); [^DWS+88]: M. Deering, S. Winner, B. Schediwy, C. Duffy, and N. Hunt, “The triangle processor and normal vector shader: A vlsi system for high performance graphics,” SIGGRAPH Comput. Graph., vol. 22, no. 4, pp. 21–30, 1988. [^ST90]: T. Saito and T. Takahashi, “Comprehensible rendering of 3-d shapes,” SIGGRAPH Comput. Graph., vol. 24, no. 4, pp. 197–206, 1990. [^MMNL14]: M. Mara, M. McGuire, D. Nowrouzezahrai, and D. Luebke, “Fast global illumination approximations on deep g-buffers,” NVIDIA Corporation, Tech. Rep. NVR-2014-001, 2014, p. 16.
Toggle Preview
Edit message
*
A description of the changes made
Discard Draft
Save Draft
leave this field blank to prove your humanity
Flag
the thing you clicked
for moderator attention.
Reason choice:
Spam, promoting, advertising without disclosure
Rude, inappropriate, generally offensive
Too arrogant or demeaning to others
Other
Reason:
The reason for raising the flag
Error