To use pixel coordinates, we need a view transformation. These are
implemented as matrices which are multiplied with the vertex positions to
transform them. A matrix consists of several vectors, giving the new
direction and size for each axis. To multiply a matrix by a vector, you
simply multiply and sum the components, going x
units in the
new x direction, y
units in the new y direction, etc.
If we leave 0 at the center, then we just need to divide the (2D) pixel coordinates by width and height respectively, and then multiply by 2 (the distance from -1 to 1), which gives us the following matrix.
$$\begin{bmatrix} 2/w & 0 & 0 \\ 0 & 2/h & 0 \\ 0 & 0 & 0 \end{bmatrix}$$<< [Per-Pixel Attributes] [Index] [Textured Quad] >>