Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Focal Length in OpenGL

314 views
Skip to first unread message

Ho Kee Ping

unread,
Sep 28, 1997, 3:00:00 AM9/28/97
to

Hi,
This may seem a stupid question really. What I want to know is "Is
there a fixed focal length defined in openGL for performing
Window to Viewport transformation? Like Renderman?". I am very new
to OpenGL and well, I need the focal length to continue on my project.

Best regards,
Ho Kee Ping

PS: Renderman's fixed focal length is 1.

Angus Dorbie

unread,
Sep 30, 1997, 3:00:00 AM9/30/97
to

Ho Kee Ping wrote:
>
> Hi,
> This may seem a stupid question really. What I want to know is "Is
> there a fixed focal length defined in openGL for performing
> Window to Viewport transformation? Like Renderman?". I am very new
> to OpenGL and well, I need the focal length to continue on my project.
>

glMatrixMode(GL_PROJECTION);
glFrustum(....);
glMatrixMode(GL_MODELVIEW);

This is all you have in the gl, and you should be able
to specify something appropriate with this.

Cheers,Angus.

Angus Dorbie

unread,
Sep 30, 1997, 3:00:00 AM9/30/97
to

Ho Kee Ping wrote:
>
> Oops, I think I did not make my question clear enough. What I needed is
> actually the location of the viewplane relative to the camera/eye
> position. The viewplane is where the image is projected onto after
> a perspective transformation.
>
> glFrustrum() and gluPerspective() defines the perspective
> transformation only (I think) but not the viewplane position.
> gluLookAt() does not specify (at least, not directly) the viewplane
> position as well.

It does specify the view plane position. The view plane in on
the near clip. In fact the actual z position is irrelevant other
than defining z and clipping, since any projection will have an
infinite number of planes. The projection generated by glFrustum
is x/y, y/z so the view plane is in the x, y plane.


>
> So, is the viewplane position fixed or variable in openGL? And if
> fixed, where is it relative to the camera. If variable, how to adjust
> it?

You can specify an arbitrary transformation matrix for your
projection stage. There is a call glFrustum which creates
a projection matrix.

Whenever I've encountered a need to 'tilt' the near clip
plane it's usually because of a conceptual misunderstanding.
You can specify a frustum which maps a window onto the x, y
plane. +ve Z under viewing transformation defines the
viewing direction. 0,0 on the near plane x, y maps to the
viewing vector so you can get any projection you like by
using asymmetric frustum in conjunction with the viewing
matrix.

Start with your display geometry and match in in the gl,
remembering that you can specify an arbitrary window on
the near plane.

Cheers,Angus.

Ho Kee Ping

unread,
Oct 1, 1997, 3:00:00 AM10/1/97
to

Oops, I think I did not make my question clear enough. What I needed is
actually the location of the viewplane relative to the camera/eye
position. The viewplane is where the image is projected onto after
a perspective transformation.

glFrustrum() and gluPerspective() defines the perspective
transformation only (I think) but not the viewplane position.
gluLookAt() does not specify (at least, not directly) the viewplane
position as well.

So, is the viewplane position fixed or variable in openGL? And if

fixed, where is it relative to the camera. If variable, how to adjust
it?

Thanks in advance.

0 new messages