23.4. Coordinate Transformations

Clip coordinates for a vertex result from shader execution, which yields a vertex coordinate Position.

Perspective division on clip coordinates yields normalized device coordinates, followed by a viewport transformation (see Controlling the Viewport) to convert these coordinates into framebuffer coordinates.

If a vertex in clip coordinates has a position given by

$\left(\begin{array}{c} x_c \\ y_c \\ z_c \\ w_c \end{array}\right)$

then the vertex’s normalized device coordinates are

$ \left(\begin{array}{c} x_d \\ y_d \\ z_d \end{array}\right) = \left(\begin{array}{c} \frac{x_c}{w_c} \\ \frac{y_c}{w_c} \\ \frac{z_c}{w_c} \end{array}\right) $