Jump to content
  • Advertisement

Archived

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

nckchan

Getting the angle of FOV

This topic is 6107 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
Share on other sites
thx for your help

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

FOV = atan(1/Val) * 2

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!