BlueTune
BlueTune

Reputation: 1053

Given a projection matrix, how can I get the field of view angle in OpenGL?

With the function

void gluPerspective(GLdouble fovy,  GLdouble aspect,  GLdouble zNear,  GLdouble zFar);

I am able to set the perspective projection matrix according to a certain field of view angle. Given a projection matrix, how can I get the field of view angle in OpenGL?

Upvotes: 2

Views: 1244

Answers (2)

Greck
Greck

Reputation: 190

For Windows and DirectX it is:

enter image description here

Upvotes: 1

Ripi2
Ripi2

Reputation: 7198

Look at gluPersperctive

In the matrix you see M[1][1] = f and f=cotang(fov/2) = 1 / tan(fov/2)

So just pick the element at [1][1] and then fov = 2·acotan(1/f)

Upvotes: 2

Related Questions