OpenGL:Framebuffers
lastmod 2024-08-28created 2024-08-054 edits
Description
A FrameBuffer is a space, a memory, that holds information about the entire screen to be drawn. You know resolution, right? 1024768 or 800480 and so on... It holds information about the screen to be drawn at that resolution.
- RenderBuffers are the components of a FrameBuffer. A FrameBuffer needs three kinds of information: Color, Depth, and Stencil. So far I understand Color and Depth; I think I need to study Stencil a bit more. A RenderBuffer is the memory space that holds each of those kinds of information.
- Frame Buffer = Color + Depth + Stencil.
- The Color Buffer stores the color information of the screen. And the Depth Buffer stores how deep each Vertex is.
- In the Depth Buffer, the points drawn on the screen have a 2D coordinate system.
- Stencil can be translated as stencil printing. As the name suggests, it works on the same principle as stencil printing. That is, you put a sheet of paper over the drawing paper and cut holes in the top sheet. Then you can draw only where the holes are cut. In other words, you cannot draw on the target paper in the areas covered by the top sheet.
- FrameBuffer = Texture + Depth + Stencil
- That said, a Texture is not a concept that corresponds 1:1 to a Color Buffer. I put it like the formula above because a Texture can be used to fill the values of a Color Buffer.
- OPENGL has a restriction on Textures. The resolution must be a power of 2. It must be expressed as a product of 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, and so on. Forms like 256100 or 200200 are not supported.
- Resolution is expressed in pixels, but when image information is read into a texture, the Color value that represents each pixel must be stored along with it. Pixel + RGBA is called a texel. Think of a texel as being at the same position as a pixel, but with a Color value stored along with it.
- Basically, you can think of a Texture as taking Color information and applying it to the desired position on a polygon. The feature that controls the desired position is TexCoordinate. However, a Texture does not store information about the whole screen, only the information the original picture has. If the picture's resolution was 500500, the texture's color information holds 500500 worth of information. Naturally, if the screen gets larger, nearby color values are used to fill the missing parts, and the picture quality drops. Knowing this much is fine for now. If you plan to study faster rendering later, this is an area that needs research.