From bc406c8bf084290765cd64af0ef290dd336e7f14 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 4 Mar 2008 17:57:06 +0000 Subject: [PATCH] From Jean-Sebastien Guay, " The problem can be reproduced by simply changing the osgpick example to use a CompositeViewer with a single view initialized using setUpViewAcrossAllScreens(). I have attached a modified osgpick.cpp so you can test it out quickly (please don't check this file in though :-) ) The eventState is then incorrect and picking does not work. The only changes are in CompositeViewer.cpp (eventTraversal() method), and fix the problem for me. " --- src/osgViewer/CompositeViewer.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/osgViewer/CompositeViewer.cpp b/src/osgViewer/CompositeViewer.cpp index a1e13d4c3..5fe8c14a7 100644 --- a/src/osgViewer/CompositeViewer.cpp +++ b/src/osgViewer/CompositeViewer.cpp @@ -658,10 +658,18 @@ void CompositeViewer::eventTraversal() { setCameraWithFocus(camera); - const osg::GraphicsContext::Traits* traits = gw ? gw->getTraits() : 0; - if (traits) + // If this camera is not a slave camera + if (camera->getView()->getCamera() == camera) { - eventState->setInputRange( 0, 0, traits->width, traits->height); + const osg::GraphicsContext::Traits* traits = gw ? gw->getTraits() : 0; + if (traits) + { + eventState->setInputRange( 0, 0, traits->width, traits->height); + } + else + { + eventState->setInputRange(-1.0, -1.0, 1.0, 1.0); + } } else {