To main page |

Homogeneous coordinates

Homogeneous coordinates is a way to represent vectors so that matrix math can be applied to them (instead of vector math). Since OpenGL does most of stuff in matrices, but you supply vectors in Cartesian coordinates to it, that's where the need comes from.

Basically if you have a vector (1,2,3), it's homogenous representations can be (1,2,3,1) or (2,4,6,2), or (-1,-2,-3,-1). All these three homogeneous vectors are the same and they are all the same as cartesian (1,2,3).

You just append a non-zero number at the end of vector coordinates and multiply all of them by this number. The revese process (Homogeneous to cartesian) is dividing all three of them by last number and dropping it out.

Homogenous to cartesian: Homogeneous (8,4,6,2) = (8/2, 4/2, 6/2) = 4,2,3.

The homogeneous coordinates are used by OpenGL internally (for example when you call glVertex to put a point - the point is converted to homogeneous coordinates, multiplied by projection and modelview matrices, and then converted from homogeneous to cartesian to be displayed on your screen.