Archived

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

Ok, so my ViewPort changes...

This topic is 5307 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

Have you guys ever noticed, that if you look at the tutorials in nehe, in windowed mode, and you resize the window, the objects will resize too,and i think to "improper" size. Correct me If I''m wrong, but this happens, because the gluPerspective function, does not get the correct fovy, for the first parameter, whenever the a resize occurs. Now, I''ve seen that nehe uses 45 degrees which is quite a nice angle to play with, the question is how do u keep that angle with resizing? I read through the red book on how to dynamically change u''r fovy so it would correctly display u''r objects when a resize occurs. The thing is, I''m not quite sure how he gets the values for his formula''s, i.e. you need the distance and size. I don''t know what the distance and size are, and how you obtain it. I''m sure there''s a few experts here which can point me in the correct direction. Thx for all replies!!!!!

Share this post


Link to post
Share on other sites
You just have to calculate the aspect ratio (2nd parameter of
gluPerspective) using the dimensions of the *current* viewport.

The angle must remain the same.

[edited by - rodzilla on June 4, 2003 6:20:51 AM]

Share this post


Link to post
Share on other sites
That is just the problem. If my aspect ratio, is say 232/64, which is round about 3.625:1, it means that I can''t use the same fov for that ratio, that I would use for say 1.3:1(800/600).

If I do , it means the picture will be distorted. I''ve manually put in other fov''s, specifically for the first mentioned ratio.
FOV of 7 degrees gives me quite a nice angle, which does not look distorted and which won''t scale down the whole picture. And that''s what I want, the question is, how do I get that FOV of 7?

Share this post


Link to post
Share on other sites