• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Getting the angle of FOV

## Recommended Posts

Hi, I want to implement the zoom function of a camera so I intend to change the parameter of glPerspective(). Before calling this function, how can I get the current angle of FOV of OpenGL setting?? Thx! William

##### Share on other sites
Well, let me see... You get the projection matrix (glGet) then let''s say the fifth value (Or [1][1] if you get it as a 2D array) is Val:
We know that (from the MesaGL source code, I downloaded it long ago, lots of good stuff in there):Val = cot(FOV)So, therefore:Val = 1/tan(FOV)1/Val = tan(FOV)atan(1/Val) = FOV

Tell me if that works, it''s late so I could make mistakes .

[Resist Windows XP''s Invasive Production Activation Technology!]

##### Share on other sites

It works after I used the sixth element to calculate and I also found that the equal should be:

FOV = atan(1/Val) * 2