Hi Robert,

Sorry about the late response, I was busy in other tasks.

This is probably the Camera's being resized relative to the original
size, and the original projection and viewport is done relative to the
defined window size.  This is done to allow for multiple cameras to
share a single window.  SimpleViewer just hardwired the aspect ratios
and viewports to exactly that of the window size so can probably get
away with more.   I would however, with Viewer expect a camera filling
the whole window to still remain filling the whole window after
resize.

Could you post how you are wiring things up?

Yes, I have made two tests, one inheriting from osgViewer::Viewer
and other one wrapping it on a class, both the same result. I
need to subclass or to wrap because I need a way to manage
things from Java.

This is the way I make things up:
MyViewer::MyViewer():osgViewer::Viewer()
{
        _gw = setUpViewerAsEmbeddedInWindow(0,0,800,600);
        _root = new osg::Group();
        setSceneData(_root.get());
        _cameraHUD = createHUD();
        _root->addChild(new osg::Group());
        _root->addChild(_cameraHUD.get());
        setCameraManipulator(new osgGA::TrackballManipulator);
        getCamera()->setPostDrawCallback(new SnapImageDrawCallback());
}

Doing things on constructor could be a problem? I'm not sure, but it's possible
that the rendering context is not created yet, when I call the constructor.

The way I'm passing events is:

myViewer->getGraphicsWindow()->getEventQueue()->....

and in the resize event I also call:

myViewer->getGraphicsWindow()->resized(x,y,w,h);

Doing some more tests I've realized that the events do not arrive to the
Manipulator. Looks like there isn't manipulator on the viewer.. but I'm
setting it. Resize event arrives but the camera projection is incorrect
just starting the viewer.


This suggests that the viewer is being destructed after the graphics
context has been destroyed.  Try destroying the viewer first then your
own window.

Yes, that was the problem! Thanks!.

Thanks!
Rafa.

--
Rafael Gaitán Linares
Instituto de Automática e Informática Industrial  http://www.ai2.upv.es
Ciudad Politécnica de la Innovación
Universidad Politécnica de Valencia
_______________________________________________
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to