Hi Daniel, Rather than keeping resetting and reassigning the graphics context I would keep them assigned all the time and instead hide the window and set the associated camera mask to 0x0.
Robert On 10 Feb 2013 18:53, "Daniel Krikun" <[email protected]> wrote: > Hello all, > > I have 2 windows, and 2 cameras, I would like to be able to assign each > camera to render to one of the windows independently, > lets say via UI. If there is a window to which no camera is assigned I > would like to hide it. If 2 cameras are assigned to the same > window, I don't care what will be displayed in that window. > > So I prepare some UI, set up osgViewer::CompositeViewer with two > GraphicsWindows, created like this: > osg::ref_ptr<osg::GraphicsContext::Traits> traits = new > osg::GraphicsContext::Traits; > traits->x = 60; > traits->y = 60; > traits->width = 800; > traits->height = 600; > traits->windowDecoration = true; > traits->doubleBuffer = true; > osg::ref_ptr<osg::GraphicsContext> gc = > osg::GraphicsContext::createGraphicsContext(traits.get()); > > I set up 2 instances of osgViewer::View, call: > view->getCamera()->setGraphicsContext(gc); for each of the views. > > Then, on UI event I add an osg::Operation to update operations queue. The > operation either sets view cameras graphics context > to NULL (if I want to discard camera output) or to one of the > above-mentioned contexts created in the beginning. > I also invoke invoke viewer->stopThreading()in the beginning of the > operation code and viewer->startThreading() at the end of it. > > What I observe is, that about one in three times when I perform such > operation, I see some noisy junk all over the window. > I also do some rendering to texture and post-processing but this is almost > surely not the problem, it works just fine. However, the noise > I see is somehow correlating w/ noise I apply in post-processing. > > Could you please advise on this matter? > > > NB: I'm using Windows XP sp3, NVIDIA GTX 670, OpenSceneGraph-2.9.8. > > -- > Daniel Krikun > > _______________________________________________ > 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

