Hi Sebastien,

You can disable whether a camera allows event focus using
Camera::setAllowEventFocus

In general if you have an app that has overlapping viewports then I
would tend to think perhaps separate views is not the most appropriate
usage of the viewer, perhaps using slave cameras (that has events
disabled) for the background would be the best route.

The other route if you really must use multiple views and each view
must really have some custom event focus scheme just go an implement
it yourself by subclassing form the view and overriding
eventTraversal().

Robert.

On Wed, Dec 3, 2008 at 4:56 PM, Sebastien Roy <[EMAIL PROTECTED]> wrote:
> Thanks Robert,
>
> Using ->setRenderOrder() does fix the problem, but only partially.
> Now the rendering of overlapping viewports is displayed correctly, but
> the mouse input events still go to the first added view.
>
> Actually, the composite viewer process events in the order of cameras of
> the GraphicsWindow, not to its own list of views. If you change the
> order of the cameras there, then you can make any camera the "top" one
> for input:
>
> osg::Camera* mycam = ... (this is the camera I want on top for input
> purposes)
>
> // get the graphics window (in my case, a simple single shared context)
> osgViewer::ViewerBase::Contexts contexts;
> osg->viewer->getContexts(contexts);
> osgViewer::GraphicsWindow* gw =
> dynamic_cast<osgViewer::GraphicsWindow*>(contexts[0]);
>
> // remove the camera and then add it at the back of the list
> osg::GraphicsContext::Cameras& cameras = gw->getCameras();
> for(osg::GraphicsContext::Cameras::iterator itr = cameras.begin(); itr !
> = cameras.end(); ++itr) {
>        if( *itr == mycam ) {
>                cameras.erase(itr);cameras.push_back(mycam);break;
>        }
> }
>
>
> So I guess changing the order of the views, both for input and
> rendering, is just a matter of changing the order of the cameras of a
> GraphicsWindow. There is a renderOrder mechanism for rendering, but no
> similar "inputOrder" mechanism... shoud there be one?
>
> In any case, is my solution reasonable?
>
> Sebastien
>
>
> Le mercredi 03 décembre 2008 à 15:17 +0000, Robert Osfield a écrit :
>> Hi Sebastien,
>>
>> The Camera::setRenderOrder(RenderOrder,int) method controls the
>> rendering order that cameras are rendering in.   If you have just one
>> camera active per view then you'd use something like:
>>
>>
>>   v1->getCamera()->setRenderOrder(osg::Camera::PRE_RENDER);
>>   v2->getCamera()->setRenderOrder(osg::Camera::POST_RENDER);
>>
>> // or...
>>
>>   v1->getCamera()->setRenderOrder(osg::Camera::NESTED_RENDER,0);
>>   v2->getCamera()->setRenderOrder(osg::Camera::NEDTED_RENDER,1);
>>
>> The rendering ordered PRE_RENDER negative to positive, NESTED_RENDER
>> negative to positive, POST_RENDER negative to positive.
>>
>> Robert.
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to