We saw earlier how translations can be represented as a matrix in homogeneous coordinates. Here we make the make a matrix for translation along x by t. OpenGL specifies matrices as a one-dimensional array listed in column-major order so that the first row in this matrix definition is the first column in the matrix, etc.

OpenGL matrices are input in column-major order. This shows the matrix and its operation on a vertex.

This matrix is used in the vertex shader to shift the vertices of the second triangle. Drag the slider under the triangles to see this matrix in action.