Transformation between vertex and fragment shaders

Hi,

I’m trying to understand the matrix transformations that happen to a vertex coordinate(as outputted by the vertex shader, say at Cg binding POSITION), before it enters the fragment shader (say, at Cg binding WPOS). I’m not interested in the way the rasterizer works in terms of filling primitives with fragments etc, so assume GL_POINTs. Assuming the vertex shader multiplies its incoming vertex coordinate by the ModelView matrix, how would you simulate the transformation of a single vertex coordinate from then on (in terms of the Perspective matrix and the viewport dimensions etc) ? Pseudo-code (like ‘mul(M, V)’ would be great).

Any help would be greatly appreciated. Thanks.

There is an excellent, but dated, discussion of the transforms in chapter three of the Red Book (available online).

Regards,
Patrick

Thanks - gluProject was what I needed (mentioned at the bottom of Chapter 3)