Hi Robert, I've tried what you suggested, setting the reference frame of the transform to osg::MatrixTransform::ABSOLUTE_RF. That works very well for the main camera. However, I think you've misunderstood my problem. I would like the cockpit to appear relative to the eye position of any child cameras in the scene too. In my case I create an RTT camera and add that as a child to the root, to generate a differant, fixed view of the scene. What i would like to do is to set the position of the cockpit relative to the position of the current camera, so that I get an interior view of the cockpit in both the main and RTT view. Is it possible using this type of transform? I've included the child camera code below if that provides any clues. Thanks, Kim. osg::ref_ptr<osg::TextureRectangle> mainView2 = createTextureRect( screenDims ); osg::Viewport* viewport = new osg::Viewport( 0, 0, screenDims.x(), screenDims.y() );
osg::Camera* camera = new osg::Camera; camera->setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); camera->setReferenceFrame ( osg::Transform::ABSOLUTE_RF ); camera->setProjectionMatrixAsFrustum( -1, 1, -1.0*0.8, 1.0*0.8, 1, 1e+006 ); camera->setViewMatrix( fixedViewMatrix ); camera->setViewport ( viewport ); camera->setRenderOrder ( osg::Camera::PRE_RENDER, 4 ); camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); camera->attach( osg::Camera::COLOR_BUFFER, mainView2.get() ); camera->addChild( renderGroup ); screenGroup->addChild( camera ); ________________________________ From: [EMAIL PROTECTED] on behalf of Kim C Bale Sent: Fri 15/08/2008 18:13 To: OpenSceneGraph Users Subject: RE: [osg-users] Getting the Current View Matrix Yes that's the case. Great, thanks for the rapid response. I'll give it a whirl. Regards, Kim. ________________________________ From: [EMAIL PROTECTED] on behalf of Robert Osfield Sent: Fri 15/08/2008 17:39 To: OpenSceneGraph Users Subject: Re: [osg-users] Getting the Current View Matrix HI Kim, Is the Cockpit fixed related to the camera position? If so just place it under a an Transform with a absolute reference frame, it'll then render relative to eye coordinates and ignore any inherited view matrix - no need for any callbacks at all. Robert. On Fri, Aug 15, 2008 at 5:34 PM, Kim C Bale <[EMAIL PROTECTED]> wrote: > Hi all, > > I've created a cockpit model which moves around along with the camera > movement. To do this I've attached an update callback to the cockpit's > transform. I pass the viewers main camera into it and use that to set the > cockpit transform to the inverse of the main camera's view matrix. This > works fine. > > However, now I want to render the scene from two differant views, both with > the cockpit attached to the camera. Once from the main camera's perspective > and again from another view setup using an RTT camera. Using my > approach, the cockpit is bound to the main cameras view and therefore, > doesn't show up in the RTT view. > > So my question is this, how can I change the cockpit transform according to > the current view point. I presume that I can't use an update callback for > this. Is it possible to get hold of the current view matrix within a > callback? > > Thanks for any help, I'm rather stumped on this one. > > Regards, > > Kim. > ***************************************************************************************** > To view the terms under which this email is distributed, please go to > http://www.hull.ac.uk/legal/email_disclaimer.html > ***************************************************************************************** > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
<<winmail.dat>>
***************************************************************************************** To view the terms under which this email is distributed, please go to http://www.hull.ac.uk/legal/email_disclaimer.html *****************************************************************************************
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org