how do we get GL_VIEWPORT_MATRIX

Hi,
I am doing Image Based Rendering and want the camera calibration. We chose OpenGL, but getting the final Camera Matrix in the form

[x y z] = K[R |t] [X Y Z]’

has become difficult.

{Assuming a simple pin-hole camera model,
K is a 3x3 camera internal parameter matrix. R,t are Rotation Translation values}

As in GL gives GL_MODELVIEW_MATRIX
and GL_PROJECTION_MATRIX only
but now a matrix form viewport tranformation.

[ w/2 0 w/2 ]
[ 0 h/2 h/2 ]
[ 0 0 0 ]

The above matrix did not give the same
points.

please let me know how to get this viewport transform in a matrix form.

[screen_pt] = [vpt] [projective_tran] [modelview_tran] [world_point]
^^^^
I want the matrix mult sequence as
x = K[R|t] * X
let me know how to compute such a K for the OpenGL camera, even if its possible
for some special conf… only

regards