A type of [[Buffer (GPU)]] for storing an [[Image]] with a [[Finite]] width $w$ and height $h$. A Frame Buffer is a rectangular grid of [[Pixel|Pixels]] where each [[Pixel]] is __centered at the [[Midpoints|Midpoint]]__ of each lattice. Each [[Pixel]] is located at an [[Integer]] [[../Math/Coordinate System|Coordinate]], $ \huge \vec p = \mat{x\\y}, \set{x,y} \in \N^+, x \in \ba{0, w}, y \in \ba{0, h} $ Every row of pixels is called a [[Scanline]], which are stored [[Contiguous|Contiguously]] in row-major order, similar to a 2D [[Array]] in memory, although there may be possible padding between [[Scanline|Scalines]]. When rendering each pixel, there are two methods: - [[Bottom Up Scaling]] ([[OpenGL]]) - [[Top Down Scaling]] ### Use of Padding [[Padding]] is required typically in order to comply with [[Alignment]] on a system. >[!example] > [[OpenGL]] uses the [[RGBA Floating Point Model]] with $24$ bits, although to have the [[Stride]] comply with the typically $4$-byte [[Alignment]], each [[Scanline]] must contain [[Padding]] ## Calculating a [[Pixel|Pixel's]] offset For calculating the offset of some [[Pixel]] $p$ in the [[Frame Buffer]] $F$ $\huge \begin{align} \let p &\in F \\ F_{i} &= p \\ i &= Sp_{y} + p_{\mathcal W}\pa{ p_{x}} \end{align} $ Where $S$ is the [[Stride]] of the [[Frame Buffer]] and $p_{\mathcal W}$ is [[Byte]] size of each [[Pixel]].