How can I take the field of view and get the vertical and horizontal angles of the view frustum?

If I could get these I can easily make a frustum culling function that is simple and should work.

Assuming a typical projection matrix as generated by e.g. glFrustum, the eye-space plane equations are:

  • x/z = -(m[8]-1)/m[0] (left)
  • x/z = -(m[8]+1)/m[0] (right)
  • y/z = -(m[9]-1)/m[5] (bottom)
  • y/z = -(m[9]+1)/m[5] (top)

The angles are the arctangents of those values.

If the projection is centred (e.g. as created by gluPerspective or similar), m[8] and m[9] will be zero, so the plane equations become ±1/m[0] and ±1/m[5] and the angles are fovX=2*atan(1/m[0]), fovY=2*atan(1/m[5]).