gareththegeek

12-13-2007, 04:03 AM

Lets say I have a screen resolution of 320x240 pixels and I am using perspective projection. What I am hoping to do is set up a projection matrix which will allow me to treat opengl x and y coordinates as screen coordinates for a certain value of z.

At this particular z value, if I were to render a quad from [ -160.0f, 120.0f ] to [ 160.0f, -120.0f ] it would exactly fill the screen.

Objects in my application should be rendered 3d with perspective so that, for example, a cube will look like a cube as it moves and rotates; just when the cube is orthogonal to the camera and at this particular z value I can treat the surface as if it were in an orthographic projection.

How can I calculate the values necessary for a call to glFrustum which will give me this matrix?

Hope I have made myself clear, if not please ask!

Many thanks,

G!

At this particular z value, if I were to render a quad from [ -160.0f, 120.0f ] to [ 160.0f, -120.0f ] it would exactly fill the screen.

Objects in my application should be rendered 3d with perspective so that, for example, a cube will look like a cube as it moves and rotates; just when the cube is orthogonal to the camera and at this particular z value I can treat the surface as if it were in an orthographic projection.

How can I calculate the values necessary for a call to glFrustum which will give me this matrix?

Hope I have made myself clear, if not please ask!

Many thanks,

G!