Brian Furtaw (brian++at++dingbat.clubfed.sgi.com)
Thu, 22 May 1997 09:10:40 -0400
If you mean lookat functionality you could always use gluLookat(...) here is
something I hacked together real fast to give you the idea of what I mean. This
program needs work.
from simple.C....
// Compute new view position.
t = pfGetTime();
pfSinCos(45.0f*t, &s, &c);
view.hpr.set(45.0f*t, -10.0f, 0);
view.xyz.set(2.0f * bsphere.radius * s,
-2.0f * bsphere.radius *c,
0.5f * bsphere.radius);
pfPushState(); // push the current gfx state onto the stack
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluLookAt(view.xyz[PF_X],view.xyz[PF_Y],view.xyz[PF_Z],
0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f);
glGetFloatv(GL_PROJECTION_MATRIX, pmat);
glPopMatrix();
pfPopState(); // pop the gfx state back
rmat.setRow(0, pmat[0], pmat[1], pmat[2], pmat[3]);
rmat.setRow(1, pmat[4], pmat[5], pmat[6], pmat[7]);
rmat.setRow(2, pmat[8], pmat[9], pmat[10], pmat[11]);
rmat.setRow(3, pmat[12], pmat[13], pmat[14], pmat[15]);
chan->setViewMat(rmat); //(view.xyz, view.hpr);
}
// Terminate parallel processes and exit
pfExit();
return 0;
...end of excerpt
What I am doing here is saving Performer gfx state then setting the matrix mode
to projection since gluLookAt writes into the projection matrix. Then set the
indentity matrix use gluLookAt with Z up read back the projection matrix pop
back the orginal projection matrix restore Performer state and set a new view
matrix for the channel.
Brian
On May 21, 10:11am, Anita Kishore wrote:
> Subject: Re: pfChannel->setView and vectors
> On May 21, 10:45am, Carsten Scharfe wrote:
> > Subject: pfChannel->setView and vectors
> > Hi Performers,
> >
> > i have some trouble with setting the view point and the
> > view direction.
> > I have a vector which is my view point and another vector
> > for my viewing direction. Lets call this vector for the direction vd.
> >
> > Is there any method to set the viewing direction with this vector vd
> > instead of using euler angles hpr?
> >
> > If yes, how do i have to do this?
> >
>
>
> If you also had an angle for you direction vector, perhaps you could use
> quaternions (pfQuat man page) by considering the direction vector as an axis
> of view.
>
> -anita
>
> kishore++at++triavest.com
> =======================================================================
> List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
>
>-- End of excerpt from Anita Kishore
--
----oOOo---- ----oOOo---- ----oOOo---- ----oOOo----
Brian Furtaw (brian++at++sgi.com)
VisSim Technical Consultant
12200-G Plum Orchard Drive Office:(410)796-0394 Fax: (301)872-3293
Silver Spring, Maryland 20904 OpenGL/ImageVision/OpenInventor/Performer
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:55:16 PDT