find the corners of the screen at a given depth?

Hello,

If I have a rectangle facing the screen in my scene, how can I determine the four corners so that it fills the screen exactly? In other words I think I want the four points where the plane of this rectangle intersects the viewing frustum.
I have some code that finds the eight corners of the entire frustum, so I should be able to intersect those planes with my rectangle’s. But I was wondering if there is a simpler way, where I don’t have to go through the math to get the whole frustum.

Thanks
Bob

Why not use an orthographic projection matrix?

If you generated the projection matrix with gluPerspective, then the top and bottom edges of the screen have y/z=±tan(fovy/2), and the left and right edges have x/z=±aspect*tan(fovy/2).

If you used glFrustum() then the left edge has x/z=left/nearVal, similarly for the other three edges.