PDA

View Full Version : glFrustum and field of view



06-19-2000, 04:05 PM
glFrustum(), which I find easy and intuitive to use,
also implicitly specifies the field-of-view/projection.
However, the problem with that is that, suppose I'm close
to an enclosure on one side, that enclosure polygon will
get clipped and whatever is outside it will be rendered.

I believe I can fix this by modifying the projection to
"zoom in" one I've set the frustum; can anyone give me
some pointers to how that is accomplished? Thanks in
advance.

06-20-2000, 04:06 PM
I answered my own question. Thanks, me. http://www.opengl.org/discussion_boards/ubb/cool.gif

glFrustum(-1., 1., -1., 1., 1., 40.);
glScalef(1.1, 1.2, 1.1);

This seems to give OK proportions and avoid the clipping
of near-side polygons revealing what's behind (I don't
allow the viewer to come closer than 0.5 units from the
edge). The 1.2 to 1.1 ratio is to compensate for my
window's aspect ratio.

Glenn Upton
06-22-2000, 03:51 PM
Remeber to recalculate all of your normals. glScale won't do it for you.

06-22-2000, 06:38 PM
Thanks for the reminder.

Talking this over with a friend and drawing it out on a
conveniently located whiteboard, I realized I was confused
about what I wanted to do; just bringing the near plane
closer and also scaling in the left/right/top/bottom
distances was what I really wanted; that will preserve
the field of view while not allowing half-clipped barriers
on the sides.