meaning of z component of projection matrix


The projection matrices in openGL are of size 4x4.

But what is the meaning of the z component, as normaly a projection matrix is of size 3x4? (projecting from 3D to 2D)

Is it the distance from your vertex to the camera plane, or is it meaningless, or … ?

thank you,

It doesn’t project straight to 2D. That would be an awful limitation.
With a three-row matrix you can only do W buffering (or no depth buffering at all, obviously). Note that W is required for perspective correction anyway. You can’t support textures in any sensible way without it.

But OpenGL uses Z/W for depth buffering, so its matrices need to have four rows to produce X,Y,Z,W.

It just projects to unit cube so that depth component remains in range [-1;1] (if I’m not mistaken with DX)