[osg-users] multiple windows

Emmanuel Roche roche.emmanuel at gmail.com
Fri Oct 26 01:22:43 PDT 2007


Yes Alberto, you're right, and I noticed this also, that's why my
GraphicsWindowWX class inherits from both wxGLCanvas and
osgViewer::GraphicsWindow as you can see in the files I joined... [this
solution comes from the osgviewerWX example].

And in addition to this you will notice  that I'm not using OnPaint to draw
the GL canvas : because this function is called only when Wx thinks it is
"needed"... I had to use an Idle function instead to handle the
viewer->frame() call often enough.

Concerning the TrackballManipulator issue I noticed that things work well if
I use "view->getEventQueue()" instead of the corresponding
GraphicsWindow->getEventQueue()...

Manu.

PS: ... Writing this, I have an other idea... the very problem comes from
the fact that I'm using an Idle function... but why am I not keeping using
OnPaint and just adding a call o Refresh() at the end !!! ??? :-) I'm
testing this right now...


2007/10/26, Alberto Luaces <aluaces at udc.es>:
>
> Hi Manu,
>
> I have been investigating a bit the event issue an I found some
> interesting
> things:
>
> The mouse event is only proccessed when the mouse pointer is over a part
> of
> the wxPanel not owned by a wxGLCanvas, that is, mouse events on the
> wxGLCanvas aren't sent to its parents. According to the Wx documentation,
> only events that are derived from wxCommandEvent are passed to the
> parents.
> The rest (and here the documentation mentions wxMouseEvent explicitly)
> aren't. So we should have to subclass from wxGLCanvas to handle those
> events
> after all.
>
> I'll post further progress.
>
> Alberto
>
> El Thursday 25 October 2007 17:23:52 Emmanuel Roche escribió:
> > Hi again guys !
> >
> > I've just tested your solution Alberto, and indeed it's working and I
> can
> > see both pages with two View on each page :-)...
> >
> > Yet I think there is still something I'm missing about the
> CompositeViewer
> > behavior : indeed, I set a trackballmanipulator for the view1 [
> > view1->setCameraManipulator(new osgGA::TrackballManipulator); ] and
> created
> > a Mouse handling function:
> >
> > void ventana::OnMouse(wxMouseEvent& event)
> > {
> >     if (event.ButtonDown()) {
> >         int button = event.GetButton();
> >         v1->getEventQueue()->mouseButtonPress(event.GetX(), event.GetY
> (),
> > button);
> >     }
> >     else if (event.ButtonUp()) {
> >         int button = event.GetButton();
> >         v1->getEventQueue()->mouseButtonRelease(event.GetX(), event.GetY
> (),
> > button);
> >     }
> >     else if (event.Dragging()) {
> >         v1->getEventQueue()->mouseMotion(event.GetX(), event.GetY());
> >     }
> > }
> >
> > ... here "v1" is the first GraphicsWindow on the tab, and, when I
> activate
> > this function by dragging the mouse on the tab nothing moves.... :-(...
> I
> > trying replacing "v1" by "cViewer" and calling
> > cViewer->setEventQueue(v1->getEventQueue()) in the initilialization
> process
> > [ because the eventQueue seems to be NULL otherwise...] but this doesn't
> > work either... Any clue about this ???
> >
> >
> > regards,
> > Manu.
> >
> > 2007/10/25, Robert Osfield <robert.osfield at gmail.com>:
> > > Hi Guys,
> > >
> > > I don't have any recommendations, or time right now to dive into this
> > > topic.  I'd certainly like to see osgViewer be able to cope with this
> > > type of usage, and its not one that its been coded for up to this
> > > point.  Might I suggest getting a tabbed WxWidget example together
> > > than could be included with the OSG distribution that illustrates the
> > > this issue and can be used as a test bed for a final recommend
> > > solution.
> > >
> > > Robert.
> > >
> > > On 10/25/07, Emmanuel Roche <roche.emmanuel at gmail.com> wrote:
> > > > Thanks a lot Alberto I guess I could not get anything more usefull
> :-)
> > > > !
> > > >
> > > > I'm checking this right now....
> > > >
> > > > Regards,
> > > > Manu.
> > > >
> > > > 2007/10/25, Alberto Luaces < aluaces at udc.es>:
> > > > > Hi Manu,
> > > > >
> > > > > I'm doing the very same thing, but with two views of a same scene
> on
> > >
> > > every
> > >
> > > > > tab. Currently it works well, but I suspect there are duplicated
> > > >
> > > > resources, so
> > > >
> > > > > I have to say that my code is not in its final version.
> > > > >
> > > > > I'm attaching it, it works for me on Linux and wx 2.6.3unmodified.
> > > > >
> > > > > Feel free to compare it with yours so we can learn together :)
> > > > >
> > > > > HTH,
> > > > >
> > > > > Alberto
> > > > >
> > > > > El Thursday 25 October 2007 12:37:45 Emmanuel Roche escribió:
> > > > > > Hello everyone!
> > > > > >
> > > > > > I've got a simple question, but I can't find any practical
> > > > > > solution:
> > > > > >
> > > > > > In my application, I have to display a notebook with a 3D window
> on
> > >
> > > each
> > >
> > > > > > tab... and I want to be able to add/remove tabs dynamically...
> so,
> > >
> > > what
> > >
> > > > can
> > > >
> > > > > > I use to achieve this result ?
> > > > > >
> > > > > > I'm usig wxWidgets + OSG 2.2.0
> > > > > > I'm on Win XP
> > > > > >
> > > > > > I tried with a CompositeViewer :
> > > > > > - creating the conpositeViewer when requested (so everything
> should
> > >
> > > be
> > >
> > > > in
> > > >
> > > > > > the wx event handling thread...)
> > > > > > - building my graphicswindowWX
> > > > > > - creating a view
> > > > > > - adding this view to the compositeview
> > > > > > - relying on an Idle function to call viewer->frame()...
> > > > > >
> > > > > > ... this works as long as there is a single tab...  but when I
> had
> > > >
> > > > others,
> > > >
> > > > > > then only the last tab added display something : the others only
> > >
> > > display
> > >
> > > > > > the blue background with no model anymore... ? why that ??
> > > > > >
> > > > > > by the way I had to make a small change in the
> > > > > > GraphicsWindowWx::makeCurrentImplementation() :
> > > > > >
> > > > > > bool GraphicsWindowWX::makeCurrentImplementation() {
> > > > > >   // Bouml preserved body begin 0001FE83
> > > > > >     if(!GetParent()->IsShown())
> > > > > >         return false;
> > > > > >
> > > > > >     SetCurrent();
> > > > > >     return true;
> > > > > >   // Bouml preserved body end 0001FE83
> > > > > > }
> > > > > >
> > > > > > --> So the hidden tabs should return false here... could this be
> > > > > > the
> > > >
> > > > source
> > > >
> > > > > > of the problem ?? (anyway wxWidgets doesn't accept SetCurrent()
> > > > > > when
> > >
> > > the
> > >
> > > > > > corresponding tab is not visible... :-S )
> > > > > >
> > > > > > regards !
> > > > > >
> > > > > > Thanks for your help !
> > > > > > Manu.
> > > > >
> > > > > _______________________________________________
> > > > > 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
> > >
> > >
> > > _______________________________________________
> > > 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/20071026/f3fe596a/attachment-0003.htm>


More information about the osg-users mailing list