[osg-users] Making the composite window disappear

Sashidhar Guntury sashidhar.moony at gmail.com
Fri Oct 19 05:33:58 PDT 2007


Hi!

              Oops, I forgot to mention that I'm not removing (i.e deleting)
view variable. I actually tried that but since the destructor is protected,
it would not work.

                thanks!

Bye

On 10/19/07, Sashidhar Guntury <sashidhar.moony at gmail.com> wrote:
>
> Hi!
>
>          I'm using the latest version of OSG (2.2) and yeah, the view is
> defined as a global variable.
>
>          These are the global variables I have defined.
>
> osg::BoundingBox* bb;
> osgViewer::CompositeViewer viewer;
> osgViewer::View* topView;
> osg::ref_ptr<osg::GraphicsContext> gc;
> osg::ref_ptr<osg::GraphicsContext::Traits> traits;
>
>          topView is the view I want to remove. It is added to viewer.
>
>                            thanks!
>
> Bye
> Sashidhar
>
> On 10/19/07, Robert Osfield <robert.osfield at gmail.com > wrote:
> >
> > Hi Sashidhar,
> >
> > Which version of the OSG are you using?  I did some work in the 2.1.x
> > series to help make adding/removing views a bit more robust.
> >
> > You call of viewer.frame() is something that you should drop as the
> > event handler you've written will be called from within frame, so you
> > are in effect creating a loop that if one is not really careful will
> > result in problems such as an infinite loop.  The call itself should
> > be required as you are already within a frame.
> >
> > Do you have any global references to the View that you are removing?
> >
> > Robert.
> >
> > On 10/19/07, Sashidhar Guntury <sashidhar.moony at gmail.com> wrote:
> > > Hi!
> > >
> > >           I'm using the composite viewer, to make a program wherein
> > there
> > > are two views of the entire scene. The main view is spread across the
> > screen
> > > while the other view lies in a corner. I want the the smaller view to
> > > disappear when I click on it (left click.)  My handle function is --
> > >
> > >  bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&
> > aa)
> > >     {
> > >         osgViewer::View* view =
> > > dynamic_cast<osgViewer::View*>(&aa);
> > >         if (!view) return false;
> > >
> > >         if (ea.getEventType() ==
> > > osgGA::GUIEventAdapter::RELEASE){
> > >                     viewer.removeView(topView);
> > >                     viewer.frame();
> > >                     cout << "Killed the map!!" << endl;
> > >         }
> > >         return false;
> > >     }
> > >
> > >                                        But when I click on
> > > the smaller view, it prints "Killed the map", but the view still
> > remains
> > > there. Why does it happen that way? Isn't viewer.frame() supposed to
> > display
> > > a completely new, updated frame?
> > >
> > >                                 thanks
> > >
> > > Bye
> > > Sashidhar
> > >
> > > _______________________________________________
> > > osg-users mailing list
> > > osg-users at lists.openscenegraph.org
> > >
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > >
> > >
> > _______________________________________________
> > osg-users mailing list
> > osg-users at lists.openscenegraph.org
> >
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20071019/3719649d/attachment-0003.htm>


More information about the osg-users mailing list