Generating a projector matrix

I am a newbie in computer graphics and Opengl.
I am doing a work for my university and I need to calculate a projection matrix containing the model view projection and the texture viewport transformation.
I am stucked for some days, I already googled and in this article
I found this formula that I think that may help me:

Te=|1/2 0 0 1/2| Pp Vp Ve^-1
|1/2 0 0 1/2|
|0 1/2 0 1/2|
|0 0 1/2 1/2|

where: Vp is the view matrix for the projector, Pp is the projection matrix and Ve^-1 is the inverse of camera (or eye).
(is it right?)

I couldn’t understand where the viewport fits here.

Also, I don’t know how to build these three matrices (Pp, Vp, Ve^-1), I have this data stored as variables:

vectors for eye,target,up;
floats for znear,zfar,fovy,aspect;

can anyone help me please? I am really stuck and I don’t know where to look for some answer or what else search in google.

Also, I found this website about the view matrix:
but I think it doesn’t apply for Opengl.

Thank you,

For constructing Pp see gluPerspective. For constructing Vp see gluLookAt.
For Ve^(-1) I don’t know how to compute it yet.

Hope that help.

That REALLY helps a lot!
Thank you!

just one more question:
do you know where does the viewport fit here?

thank you

See glViewport.
See gluProject for the process of transforming the position of a vertex in the screen.

Edit: WinZ is the value ([0.0 1.0]) stored in the depth buffer.

Thank you again.
My question is: do you know where it fits in this matrix we just created?
I can’t understand that.

Thank you,

Check out the red book:


Ok, I will.

Thank you both for your help!


Look the figure 3 at the bottom of page 3. Unlike the camera transform, I think there is no viewport transform for the projector transform. If you compare the final stage of both transform, the final stage of the camera transformation transform the normalized device coordinate (NDC space) [-1 1] for each x,y,z to [0 viewport_width] [0 viewport_height] and [0 1] for window space. The final stage of the projector transformation transform the projector clip space to the texture space [0 1] (this is the scale and bias matrix).

Hope that I have answered right this time.