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

Reply via email to