Hi,
I am new to osg, so I apologise if this question seems trivial. I have
looked through the examples and documentation with no luck.

I am using a composite viewer, and have two views.
I want to be able to let the user disable and enable one of the views
using the keyboard keys.

I have something like this:

osgViewer::CompositeViewer viewer(arguments);

// view one
osgViewer::View* viewOne = new osgViewer::View;
viewer.addView(viewOne);
viewOne->setSceneData(scene.get());
viewOne->getCamera()->setViewport(new osg::Viewport(0,0,
traits->width/2, traits->height/2));
viewOne->getCamera()->setGraphicsContext(gc.get());

// view two
osgViewer::View* viewTwo = new osgViewer::View;
viewer.addView(viewTwo);
viewTwo->setSceneData(scene.get());
viewTwo->getCamera()->setViewport(new osg::Viewport(traits->width/2,0,
traits->width/2, traits->height/2));
viewTwo->getCamera()->setGraphicsContext(gc.get());


So, when the user presses the "d" key, I want to disable view two, and
when the user presses the "e" key, I want to enable back view two.
I thought that just removing the view from the viewer should do it,
i.e. something like:

void disable()
{
 viewer.removeView(viewTwo));
}

void enable()
{
 viewer.addView(viewTwo);
}

but osg crashes when I disable the view. It looks like viewerTwo's
camera is still on the GraphicsContext list of cameras?

How does one disable/enable a view on the composite viewer?

Thanks
Juan 


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to