Each frame, you have to update your matrix. For the moment you set it, next
you frame() the viewer, nothing more. Matrix will no update itself.

To update it, do it in the viewer loop (after/before frame()), or create a
new nodeCallback. Have a look on nodeCallback to see how to use it.

Regards,
   Vincent.

2008/12/17 olfat ibrahim <[email protected]>

> i have two viewers and put the scene in groups one for the whole scene and
> one for the pointer i want to move:
>
> osg::Group* root = new osg::Group; // groupp have all other objects
>        osg::Group* Mainroot = new osg::Group; // the whole scene
>        Mainroot->addChild(root);
>
> osgViewer::Viewer viewer;
> osgViewer::Viewer viewer1;
>
> //set left camera for left view
> osg::ref_ptr<osg::Camera> cameraL = new osg::Camera;
> ...
> // add the matrix transformation
> osg::MatrixTransform* mt = new osg::MatrixTransform;
>                 mt->setMatrix( cameraL->getViewMatrix() );
>                 mt->addChild( loadedMode35 );
>                Mainroot->addChild(mt);
>
> viewer.setCameraManipulator( keyswitchManipulatorL.get() );
>
> //set right camera for the right view
> osg::ref_ptr<osg::Camera> cameraR = new osg::Camera;
>
> viewer1.setCameraManipulator( keyswitchManipulatorR.get() );
>
>
>
> //load data for each viewer
> viewer.setSceneData( root);
> viewer1.setSceneData( Mainroot);
>
>
> //run the viewer
> while( !viewer.done() )
>    {
>        // fire off the cull and draw traversals of the scene.
>        viewer.frame();
>        viewer1.frame();
>
>    }
>
> now the object i used did not move what is the problem ??
>
> --- On Wed, 12/17/08, Vincent Bourdier <[email protected]> wrote:
>
> > From: Vincent Bourdier <[email protected]>
> > Subject: Re: [osg-users] current View Point
> > To: [email protected], "OpenSceneGraph Users" <
> [email protected]>
> > Date: Wednesday, December 17, 2008, 2:46 AM
> > Hi,
> >
> > Please, make replies to your posts ! do not make a new
> > thread each time ...
> > If you reply to your post, we will have all the mailing
> > history of this
> > question, and we can see the evolution of the problem.
> >
> > Next, just with this code, we cannot see what the problem
> > is.
> > Tell us what is good in your code, what you want to do with
> > this code...
> >
> > For your problem : maybe it works, but you need a callback
> > or a loop to see
> > the matrix changing in real-time... Not easy to understand
> > this little peace
> > of code without more explanations.
> >
> > Regards,
> >    Vincent.
> >
> > 2008/12/16 olfat ibrahim <[email protected]>
> >
> > > hi :
> > >
> > > iam creating a program that have two windows one i
> > make a drive in it and
> > > the other is like a map i want to put indecator in the
> > 2nd window that
> > > indicate my current position in the first one
> > >
> > > i used the following code but nothing happend:
> > >
> > >
> > > // Projection and ModelView matrices
> > >    osg::Matrixd proj;
> > >    osg::Matrixd mv;
> > > ...
> > > proj = cameraL->getProjectionMatrix();
> > >
> > >  mv = cameraL->getViewMatrix();
> > >                // Create parent MatrixTransform to
> > transform the view
> > > volume by
> > >                // the inverse ModelView matrix.
> > >                osg::MatrixTransform* mt = new
> > osg::MatrixTransform;
> > >                mt->setMatrix(
> > osg::Matrixd::inverse( mv ) );
> > >                mt->addChild( loadedMode35 );
> > >                Mainroot->addChild(mt);
> > >
> > > ...
> > >
> > >
> > > can some one tell me where iam going wrong ??
> > >
> > >
> > > tahnks
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > osg-users mailing list
> > > [email protected]
> > >
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > >
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to