Re: Field of view computation by pfChannel

New Message Reply Date view Thread view Subject view Author view

Scott Herod (herod++at++evt.com)
Wed, 04 Nov 1998 11:24:55 -0700


Hello Benedikt,

  Thanks for your response. I checked that the pipe window has the
correct size when I set the FOV, but the channel apparently doesn't
compute the FOV, it's viewFrust has an incorrect field of view.
This is after a window is created and in fact the pfPipeWindow that
is linked to the channel has the correct sizes.

  My fix, since I do know the window size at initialization time and
all later times when I'm changing the FOV, is to add the following:

   // Force performer to acknowledge our window size.
   chan->setAspect( PFFRUST_CALC_HORIZ,
                    (float)(win_width) / (float)(win_height) );
   chan->setFOV(0.0f, fov); // specify VERTICAL FOV

This required the least change and is backwards compatible.

  I also attach a spline to the fov variable and allow a user to change
it to create a "zoom in/out" effect. Thus I need to maintain as much
similarity to our older code as possible.

Scott Herod
scott++at++evt.com

Benedikt Kessler wrote:
>
> Hi!
>
> Here is just a guess:
>
> Probably just the window (or widget) you are using for the pipewindow does
> not yes exist so that performer can't get the size of the window (you
> might check yourself using pfPipeWindow::getSize(int *xs, int *ys);). In
> this case Performer will use the pipe's screen size and compute the aspect
> according to these sizes.
>
> I'm missing the call to pfPipeWindow::open(void);
> Do you open the window in the draw process?
>
> It looks like you should set the FOV of your channel (or call
> channel->setAutoAspect(PFFRUST_CALC_HORIZ)) after the window has been
> opened.
>
> Bye! Benedikt
>
> Scott Herod wrote:
>
> > I'm getting a strange error with pfChannel's field of
> > views. It looks like horizontal FOV are not computed if
> > the PipeWindow is attached to a X window as in
> >
> > float fov = 45.0f;
> >
> > // Create and configure a window.
> > pfPipe *pipe = pfGetPipe(0);
> > pfPipeWindow *pipeWindow = new pfPipeWindow( pipe );
> > pipeWindow->setWSWindow( display, XtWindow(_glwidget) );
> > pipeWindow->setGLCxt( _glxcontext );
> > pipeWindow->setWSDrawable( display, XtWindow(_glwidget) );
> >
> > // Create and configure a pfChannel.
> > pfChannel *channel = new pfChannel( pipe );
> > channel->setNearFar( 1.0f, 8000000.0f );
> > channel->setFOV( 0.0f, fov );
> > pfCoord view;
> > view.hpr.set( 0.0f, -90.0f, 0.0f );
> > float z_distance = winHeight/2 / tanf( fov * (3.1415926/180.) / 2.
> > );
> > view.xyz.set( 0.0f, 0.0f, z_distance );
> > channel->setView( view.xyz, view.hpr );
> >
> > It appears that the channel is using an aspect ratio of 1.25
> > regardless of the size of the window. Furthermore, this is
> > a change from pf 2.0.4 where the channel could grab the window size.
> > Can someone verify that aspect ratios are not changed?
> >
> > Thanks,
> >
> > Scott Herod
> > scott++at++evt.com
> >
> +---------------------------------+----------------------------------+
> |Benedikt J. Kessler | Silicon Graphics GmbH


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Wed Nov 04 1998 - 10:25:02 PST

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.