I have not an extremely deep knowledge of the intricacies of OSG code, but
if there
is something I can help with, let me know.

  Anyway, is it OK to use osgDB::writeObjectFile on the osgViewer::Viewer
object to
create the config file?


  Best regards,
  Javier Taibo.

On Thu, Oct 14, 2010 at 9:24 AM, Robert Osfield <[email protected]>wrote:

> Hi Javier,
>
> Thanks for pointing these problems out, I hadn't tested the viewer
> configuration plugin recently so hadn't spotted the regression.  I
> suspect the regression happened when we merged the new serialization
> support.  I'll put fix the viewer configuration on my TODO list for
> the week.
>
> Cheers,
> Robert.
>
> On Wed, Oct 13, 2010 at 10:27 PM, Javier Taibo <[email protected]>
> wrote:
> >   Hi,
> >
> >   I am trying to figure how to use config files for camera definition
> with
> > osgviewer.
> > After some search in the list and browsing the code, it seems that camera
> > config files
> > can be passed to osgviewer in two ways: the environment variable
> > OSG_CONFIG_FILE
> > and the command-line option "-c". There are some examples in
> > OpenSceneGraph-Data/Configuration (with .view extension), but they fail
> in
> > different ways:
> >
> >   osgviewer -c Configuration/SingleScreen.view cow.osg
> >
> > Warning: Could not find plugin to read objects from file
> > "Configuration/SingleScreen.view".
> >
> >   OSG_CONFIG_FILE=Configuration/SingleScreen.view
> >   osgviewer cow.osg
> >
> > Warning: Could not find plugin to read objects from file
> > "Configuration/SingleScreen.view".
> > Viewer::realize() - failed to set up any windows
> > Warning: Could not find plugin to read objects from file
> > "Configuration/SingleScreen.view".
> > Viewer::realize() - failed to set up any windows
> >
> >   It seems that the program cannot find the plug-in to read ".view"
> files.
> >  What plug-in is this? Isn't it "osgdb_osgviewer"?
> >
> >   Anyway, after browsing the source and experimenting a little more, I
> > managed to get it working
> > with regular .osg files (instead of .view) that I created with
> > osgDB::writeObjectFile from an
> > osgViewer::Viewer with the desired configuration. It works with the
> > command-line option:
> >
> >   osgviewer -c mycamera.osg model.osg
> >
> >   But using the environment variable OSG_CONFIG_FILE still does not work,
> it
> > keep showing
> > the following messages:
> >
> > Viewer::realize() - failed to set up any windows
> > Viewer::realize() - failed to set up any windows
> >
> >   One last issue with camera config in the command-line option is that
> even
> > though it work
> > for the projection matrix and other features, the initial view is reset
> by
> > osgviewer. To avoid
> > this, I added this code to osgviewer.cpp after keyswitchManipulator
> creation
> > and configuration.
> >
> >         if ( arguments.read("--noautohomeview") ) {
> >             osg::Vec3 eye, center, up;
> >             viewer.getCamera()->getViewMatrixAsLookAt( eye, center, up );
> >             keyswitchManipulator->setHomePosition( eye, center, up );
> >         }
> >
> >   This way, the config file view matrix is set as home position for the
> > manipulator, what
> > prevents the manipulator to override it. It is activated with a
> command-line
> > option, to keep
> > backwards compatibility.
> >
> >   Btw, I am using OSG 2.9.9.
> >
> >   My questions are:
> >   Is all this config file system deprecated? (the -c command-line option
> is
> > not shown in the
> > osgviewer help)
> >   If it is not, what am I doing wrong?
> >   Is there any way to see the initial camera position defined in the
> config
> > file,
> > without needing to modify the osgviewer code?
> >
> >   Any help would be very appreciated.
> >
> >
> >   Best Regards,
> >   Javier Taibo.
> >
> >
> > _______________________________________________
> > 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