Robert

I have attached example source code to explain what I mean:

in the viewport area of the topview (upper right part of the window) I can't
use the trackball.

To switch off the topView, should I better use viewer.removeView(topView)
instead of topView->setNodeMask (0x0); ?


Dieter



-----Original Message-----
From: [email protected]
[mailto:[email protected]]on Behalf Of Dieter
Pfeffer
Sent: Friday, 20 February, 2009 13:08
To: OpenSceneGraph Users
Subject: Re: [osg-users] picking / trackball question - compositeviewer



Robert

thanks and sorry for the confusing questions (I have mixed two applications)

I try to explain my 2. question again :

I use the trackballmanipulator in one view and only picking in another view
(topview); but when I switch off the topview
(topView->getCamera()->setNodeMask (0x0);), I don't have trackball
functionality in the area of this view (upper right part of the window)


Dieter




-----Original Message-----
From: [email protected]
[mailto:[email protected]]on Behalf Of Robert
Osfield
Sent: Friday, 20 February, 2009 11:57
To: OpenSceneGraph Users
Subject: Re: [osg-users] picking / trackball question - compositeviewer


Hi Dieter,

Your use mixing of the use of views and master and slaves is rather
confusing.  The osgViewer approach is to separate both the
implementation and concept of View and Cameras, this is done to keep
clear what class does what, and when to use to different
configuration.

A single View "has a" master Camera, and a list of zero or more slave
Camera.  There is no such thing as a master View, or slave View, only
master Camera and slave Camera within a single View.

A single View is controlled by single CameraManipulator which controls
the master Camera, the slave Camera's within this view are then sync'd
relative to the master Camera on each frame.

An osgViewer::Viewer "is a" View, so has one master, and the ability
to have zero or more slave Camera, and only has a single
CameraManipulator.  This keeps the Viewer class quite straight
forward, yet still have the capability of doing power walls etc.

An osgViewer::CompositeViewer "has a" list of View, each View has it's
own master Camera, it's own slaves, it own CameraManipulator.

At your end you need to decide what type of viewer configuration you
need.  If it's just a single conceptual view then use Viewer, even if
you require an advanced display configuration as the slave cameras can
handle this.  If you have multiple conceptual views (i.e. the view
that two different viewpoints on the scene or two different scenes)
then use CompositeViewer.

Robert.


On Fri, Feb 20, 2009 at 10:39 AM, Dieter Pfeffer
<[email protected]> wrote:
> Hi
>
> I have 2 questions concerning multiple views with compositeviewer
>
> 1. when I have three views (1 master and two slaves) - is it possible to
> have the Trackballmanipulator over all three views (now I have the
trackball
> only in the master view) ?
>
> 2. in another configuration I use  the trackballmanipulator in the master
> view and only picking in a slave view (see the attached image - picking in
> the top view); but when I switch off the slave view (topview), I don't
have
> trackball functionality in the area of this view (upper right part of the
> window)
>
>
> Thanks
>
> Dieter
>
>
>
> Unclassified Mail
>
>
> --------------------------------------------------------------------------
----------------------------------
> Disclaimer:
>
> If you are not the intended recipient of this email, please notify the
> sender and delete it.
> Any unauthorized copying, disclosure or distribution of this email or its
> attachment(s) is forbidden.
> Thales Nederland BV will not accept liability for any damage caused by
this
> email or its attachment(s).
> Thales Nederland BV is seated in Hengelo and is registered at the Chamber
of
> Commerce under number 06061578.
> --------------------------------------------------------------------------
----------------------------------
>
>
> _______________________________________________
> 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


----------------------------------------------------------------------------
--------------------------------
Disclaimer:

If you are not the intended recipient of this email, please notify the
sender and delete it.
Any unauthorized copying, disclosure or distribution of this email or its
attachment(s) is forbidden.
Thales Nederland BV will not accept liability for any damage caused by this
email or its attachment(s).
Thales Nederland BV is seated in Hengelo and is registered at the Chamber of
Commerce under number 06061578.
----------------------------------------------------------------------------
--------------------------------

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


------------------------------------------------------------------------------------------------------------
Disclaimer:

If you are not the intended recipient of this email, please notify the sender 
and delete it. 
Any unauthorized copying, disclosure or distribution of this email or its 
attachment(s) is forbidden. 
Thales Nederland BV will not accept liability for any damage caused by this 
email or its attachment(s). 
Thales Nederland BV is seated in Hengelo and is registered at the Chamber of 
Commerce under number 06061578.
------------------------------------------------------------------------------------------------------------

/* OpenSceneGraph example, osgcompositeviewer.
*
*  Permission is hereby granted, free of charge, to any person obtaining a copy
*  of this software and associated documentation files (the "Software"), to deal
*  in the Software without restriction, including without limitation the rights
*  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
*  copies of the Software, and to permit persons to whom the Software is
*  furnished to do so, subject to the following conditions:
*
*  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
*  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
*  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
*  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
*  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
*  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
*  THE SOFTWARE.
*/

#include <osgUtil/Optimizer>
#include <osgDB/ReadFile>

#include <osgDB/FileUtils>
#include <osgDB/WriteFile>
#include <osg/Material>
#include <osg/Geode>
#include <osg/BlendFunc>
#include <osg/Depth>
#include <osg/Projection>
#include <osg/PolygonOffset>
#include <osg/MatrixTransform>
#include <osg/Camera>
#include <osg/FrontFace>

#include <osgText/Text>

#include <osgGA/TrackballManipulator>
#include <osgGA/FlightManipulator>
#include <osgGA/StateSetManipulator>
#include <osgViewer/ViewerEventHandlers>

#include <osgViewer/CompositeViewer>

#include <osgFX/Scribe>

#include <osg/io_utils>
 
int main( int argc, char **argv )
{

    // use an ArgumentParser object to manage the program arguments.
    osg::ArgumentParser arguments(&argc,argv);
    
  

    // construct the viewer.
    osgViewer::CompositeViewer viewer;//(arguments);
    osg::ref_ptr<osg::Node> scene = osgDB::readNodeFile("cow.osg");
    if ( scene.valid() == false) return 1;
     
     
         osgUtil::Optimizer optimizer;
     optimizer.optimize(scene.get());
      
  
    {    
     osg::GraphicsContext::WindowingSystemInterface* wsi = 
osg::GraphicsContext::getWindowingSystemInterface();
        if (!wsi) 
        {
            osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface 
available, cannot create windows."<<std::endl;
            return 1;
        }

        unsigned int width, height;
        wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), 
width, height);

        osg::ref_ptr<osg::GraphicsContext::Traits> traits = new 
osg::GraphicsContext::Traits;
        traits->x =  0;
        traits->y =  0;
        traits->width = 1024;
        traits->height = 768;
        traits->windowDecoration = true;
        traits->doubleBuffer = true;
        traits->sharedContext = 0;

        osg::ref_ptr<osg::GraphicsContext> gc = 
osg::GraphicsContext::createGraphicsContext(traits.get());
        if (gc.valid())
        {
            osg::notify(osg::INFO)<<"  GraphicsWindow has been created 
successfully."<<std::endl;
 
            gc->setClearColor(osg::Vec4f(0.2f,0.2f,0.6f,1.0f));
            gc->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        }
        else
        {
            osg::notify(osg::NOTICE)<<"  GraphicsWindow has not been created 
successfully."<<std::endl;
        }
                
                 width = traits->width;
                 height = traits->height;
                 
      
        {
             
            osgViewer::View* view0 = new osgViewer::View;
            viewer.addView(view0);
            view0->getCamera()->setGraphicsContext(gc.get()); 
            view0->getCamera()->setViewport(new osg::Viewport(0,0,width,height 
));
            
                        
view0->getCamera()->setProjectionMatrixAsPerspective(40.0f, 
static_cast<double>(width  )/static_cast<double>(height ), 1, 1000.0);
   
                        view0->setSceneData(scene.get());
                        view0->setCameraManipulator(new 
osgGA::TrackballManipulator);
        }
        
        
        {
                osgViewer::View* topView = new osgViewer::View;
                viewer.addView(topView);
                        
                        topView->getCamera()->setGraphicsContext(gc.get()); 
                        
topView->getCamera()->setProjectionMatrixAsPerspective(30.0f, 
static_cast<double>(width )/static_cast<double>(height ), 1.0, 1000.0);
                        topView->getCamera()->setViewport(new osg::Viewport( 
width/2. ,height/2.,width ,height ));
                        topView->setSceneData(scene.get());
                         
                        topView->getCamera()->setNodeMask (0x0);
                        
                        //      viewer.removeView (topView);    
        }

    }
   
    
     while (!viewer.done())
     {
                viewer.frame();
     }
   
}
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to