Hello!
I used the viewer.run() method to start the viewer.
viewer.getCameraManipulator() returns zero. However, changing from the
viewer.run() to your loop solved the problem, even without the setViewMatrix
call. The reason is in osgViewer::Viewer. Browsing the sources I found this:
if (!getCameraManipulator() && getCamera()->getAllowEventFocus())
{
setCameraManipulator(new osgGA::TrackballManipulator());
}
Is there a reason that calling run() requires a manipulator?
In any case, the problem is easily solved by either not calling run() or
adding a custom manipulator which does nothing.
Anyway, thanks for pointing me in the right direction.
/Peter
On 2007-07-28 (Sat) 22:08, Robert Osfield wrote:
> Hi Peter,
>
> I presume what you are up against is the use of a Camera Manipulator
> that is setting the viewer's Camera's View Matrix on each frame.
>
> If you don't want the standard manipulator then don't register one,
> and instead set the view matrix on each frame i.e
>
> viewer.realize();
> while(!viewer.done())
> {
> osg::Matrixd myViewMatrix = ....; // compute in some way.
> viewer.getCamera()->setViewMatrix(myViewMatrx);
> viewer.frame();
> }
>
> Or alternatively you could just set the home position of the camera
> manipulator.
>
> Robert.
>
> On 7/28/07, Peter Gebauer <[EMAIL PROTECTED]> wrote:
> > Hi all!
> >
> > I've found the Viewer very useful in creating quick, browsable scenegraphs,
> > but I've hit a problem.
> >
> > The viewer camera always translates and rotates to fit the entire
> > scenegraph at startup. This is a problem when I want to start with more
> > distance or slightly skewed angles. The result is that all my transforms
> > are "nullified" by the camera compensating for it when starting.
> >
> > I can move about the scenegraph using the default controls, that's not a
> > problem, the problem is only that the starting scenegraph render is not what
> > I want or what my manual scenegraph transforms should produce.
> >
> > Is there any way to get the default camera of the viewer and disable this
> > automatic transform? Maybe I can do it directly on the viewer instance?
> >
> > /Peter
> > _______________________________________________
> > 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