After the model and view transforms, why are the projection matrix and the viewport transforms separate? It seems like they should just be one matrix. The only guess I can come up with is that it is helpful to some hardware to have clip co-ordinates that are in the range of 0.0 to 1.0

Does anyone really know why these are separate?

Thanks

There are two different reasons for the two separate transforms. Lighting is usually done in eye space (and by “usually”, I mean the fixed-function pipeline defines it to happen there), so you need at least two matrices so that OpenGL can know what the eye-space position of things are. Other computations are done in eye-space too.

The viewport transform can’t be used, simply because of the nature of projection. The coordinate system after the projection matrix is clip-space, which is a 4D homogeneous coordinate system. The next step (after clipping) is normalized device coordinate (NDC) space, which divides the first 3 components of the position by the W component. That division, often called the perspective divide, cannot be done with a matrix.

The viewport transform operates on NDC-space positions. So it can’t be folded into the projection matrix. Also, clipping happens in the aptly named clip-space. Clipping can generate vertices, so you can’t just fold that into a matrix transform.

Thanks, that was good information, and the link you gave, points to an excellent book, one that explains what is *really* going on, *instead* of just saying do things this way because you are supposed to do it this way.

Thanks that link is quite useful as well.