Have I understood fovy correctly? Is there somewhere where this is
defined precisely (the Red Book definition is a bit vague)?
thanks
Gib
fovy is field-of-view-in-the-y-dimension -- that is, your
"vertical" angle.
--
Andy V (OpenGL Alpha Geek)
"In order to make progress, one must leave the door to the unknown ajar."
Richard P. Feynman, quoted by Jagdish Mehra in _The Beat of a Different Drum_.
OpenGL Technical FAQ: http://www.opengl.org/developers/faqs/technical.html
Gee thanks ;). Apparently I failed to make it clear that my question
relates to determining this angle, given an arbitrary geometry. In the
sentence you quote I'm saying that I set fovy either equal to the
vertical angle, or to 3/4 of the horizontal angle, depending on their
ratio compared with the screen aspect ratio. The determination of the
angles is the crucial step.
Gib
In case anyone is interested ... I finally figured out the explanation,
and it is a bit subtle.
The aspect ratio applies to the projected dimensions, not the angles. I
was scaling the horizontal angle by 3/4 to get fovy (when the horizontal
dimension is limiting). What I should have been doing is this
(horizontal and vertical angles are in radians):
aspect_ratio = 4.0/3.0;
halfwidth = tan(horizontal_angle/2);
halfheight = tan(vertical_angle/2);
if (halfwidth/halfheight > aspect_ratio) {
// use horizontal angle to set fovy
fovy = 2*atan(halfwidth/aspect_ratio);
} else {
// use vertical angle to set fovy
fovy = vertical_angle;
}
fovy = fovy*180/PI;
This works.
Gib
The FOV is applied in the vertical direction, yes.
--
<\___/>
/ O O \
\_____/ FTB.
Not another one! The issue is not about fovy being vertical, it is how
to select fovy to maximize the image size on screen. Either the
vertical dimension or the horizontal dimension will be limiting. You
apparently didn't take the time to understand my posts. No reason why
you should, of course :)
Gib
> Not another one! The issue is not about fovy being vertical, it is how
> to select fovy to maximize the image size on screen. Either the
> vertical dimension or the horizontal dimension will be limiting. You
> apparently didn't take the time to understand my posts. No reason why
> you should, of course :)
Clearly you should have asked not about fovy, but about how
to calculate parameters to gluPerspective.
I think one should read a post carefully before responding to it,
especially before responding in a way that treats the poster as an
idiot. fovy _is_ the relevant parameter to gluPerspective(). My
question was about determining the fovy value to use when the horizontal
field-of-view angle is limiting, and the key to my misunderstanding is
that the aspect ratio does not apply to field-of-view angles. For small
field-of-view angles the difference between applying the aspect ratio to
field-of-view angles and applying it to the dimensions of the image
projected on a view plane (i.e. the correct way) is very small, and so
it is possible to use it the wrong way and not notice the error. Since
I am trying to determine the minimum fovy very precisely to just fit the
object within the screen my error became obvious.
Gib