I dont understand what happens to the z-values after a projection. According to the red book, a call to glFrustum(l,r,t,b,n,f) creates

a matrix R where:

Z-row: 0 0 -(f+n)/(f-n) -2fn/(f-n)

W-row: 0 0 -1 0

As I understand it, this matrix is a concatenation of an orthographic projection matrix

and a perspective projection matrix. It should map the perspective view volume onto the

canonical view volume (with x,y,z in [-w,w]). My problem is I dont see how this matrix maps

depth values exactly. Projecting a point p(x,y,z,1) under R gives:

p’.z = p.z * -(f+n)/(f-n) - 2fn/(f-n)

p’.w = -p.z

p’.z / p’.w = (f+n)/(f-n) + 2fn/(f-n)*p.z

Now when p.z = n (near plane) the latter formula should yield -1. It results in

p’.z / p’.w = (f+n)/(f-n) + 2f/(f-n) = (3f+n)/(f-n)

Same for p.z = f (far plane) one should get 1. It results in

p’.z / p’.w = (f+n)/(f-n) + 2n/(f-n) = (3n+f)/(f-n)

Is there a reason for this ‘wrong’ mapping? I have read some regular projection matrix derivatons and I understand them, they also

work on examples, but I dont see the logic in what opengl does with the z-values here.

Thanks for reading this long post,

greets,

groovemaster.