Maybe my problem declaration is unclear. Sorry about this. The goal is I doesn't want to set the camera (master camera) of the viewer. That do the CameraManipulator. I want use the Matrix (or inverse matrix) to set the view matrix of another camera. I have 4 cameras (viewports) and I want change only the camera of one viewport.
Is this an better explanation? I hope so. Cheers Martin -------- Original-Nachricht -------- > Datum: Wed, 03 Nov 2010 09:20:44 -0400 > Von: "Jean-Sébastien Guay" <[email protected]> > An: OpenSceneGraph Users <[email protected]> > Betreff: Re: [osg-users] How can I calculate a matrix via a MatrixManipulator > Hello Martin, > > > I have try this way, but it doesn't work. I guess the manipulator needs > more information. For example, when I set the manipulator in the viewer via > addEventHandler(), it doesn't work. A manipulator must set with > setCameraManipulator(). > > Well I don't know much about what you're doing, just small bits of > information... Is "the manipulator" above your own manipulator or the > trackball manipulator? > > What I thought you were doing was: > > > class MyCameraManipulator : public osgGA::CameraManipulator > { > public: > MyCameraManipulator() : osgGA::CameraManipulator(), _trackball(new > osgGA::TrackballManipulator) {} > > virtual bool handle(ea, aa) > { > // handle my events > > //at the end, call trackball so it also handles its events > return _trackball->handle(ea, aa); > } > > virtual osg::Matrixd getInverseMatrix() > { > return _trackball->getInverseMatrix(); > } > > // ... > }; > > // in main() > > viewer->setCameraManipulator( new MyCameraManipulator ); > > > This should work, I think. If it doesn't then you need to start up your > debugger and trace what's going on, I can't do it for you... > > The basic principle is that the view will call its camera manipulator's > getInverseMatrix() method once per frame to get the updated view matrix. > It won't do this for a general event handler set by addEventHandler()... > If you don't set a camera manipulator on your view(er), then you need to > pass it a view matrix some other way, because no one will call your > camera manipulator's getInverseMatrix()... So you can't set the > manipulator with addEventHandler(), it doesn't make sense, because the > camera manipulator is a special event handler whose getInverseMatrix() > method must be called. > > Hope this helps, > > J-S > -- > ______________________________________________________ > Jean-Sebastien Guay [email protected] > http://www.cm-labs.com/ > http://whitestar02.webhop.org/ > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- GRATIS! Movie-FLAT mit über 300 Videos. Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

