Again thank you very much, I implemented as you suggested and it works
fine...
Now I have problems when picking the text that is "really" under the mouse
cursor after having moved the point of view (by a trackball manipulator) ...
the picker returns the text above or below the intended menu item...may
depends on bounding boxes and their update? If this is the case, should I
call dirtyBound() method? Considering that the point of view is often
moving, where is the most appropriate place to call it?

By the way, concerning the original problem relating to intersectors and
geometry object, it looks like that with Text object, intersections are
found even if you click on the text and not on the vertex of its bounding
box.

Thanks.
Alessandro


On 4/23/07, Andreas Goebel <[EMAIL PROTECTED]> wrote:

alessandro terenzi schrieb:

Ok. I understand, thanks.

Now, I would like to ask some suggestions about the right approach to
implement mouse interactions with a 3D menu and 3D menu items.

I guess that basically, considering that Text is not a geode :) the
easiest solution would be to have a group (representing the menu) to which I
would attach as many geodes as the menu items (so one geode <--> one menu
item) ...so it would be easy to retriveve and identify the picked menu item
... otherwise if I would use a single geode and attach many Text objects to
it, then I should implement some method to cycle through the
geode's drawables and to identify the right drawable menu item...it looks
like this approach is much more complicated...what do you think?

No, its much easier than that. Look at the members of
osgUtil::LineSegmentINtersector::Intersection:

  Public Attributes double  
ratio<http://mail.google.com/mail/?attid=0.0.1.1&disp=emb&view=att&th=1121f11c22a0a1a5>
osg::NodePath<http://mail.google.com/mail/?attid=0.0.1.2&disp=emb&view=att&th=1121f11c22a0a1a5>
  
nodePath<http://mail.google.com/mail/?attid=0.0.1.3&disp=emb&view=att&th=1121f11c22a0a1a5>
osg::ref_ptr<http://mail.google.com/mail/?attid=0.0.1.4&disp=emb&view=att&th=1121f11c22a0a1a5><
osg::Drawable<http://mail.google.com/mail/?attid=0.0.1.5&disp=emb&view=att&th=1121f11c22a0a1a5>>
drawable<http://mail.google.com/mail/?attid=0.0.1.6&disp=emb&view=att&th=1121f11c22a0a1a5>

The drawable member gives you the drawable that was picked.

So if you take one geode for each menu and one drawable for each menu item
then the geode will give you the menu and the drawable the menu item!
Of course taking a single geode for each menu item would work, too, but
taking a geode per menu and a drawable per menu item would represent the
structure of a menu much better, I think.

Regards,

Andreas


Thanks.
Alessandro


On 4/23/07, Andreas Goebel <[EMAIL PROTECTED]> wrote:
>
> alessandro terenzi schrieb:
> > Actually, problem is that when clicking on a Text object, it is picked
>
> > correctly (...I mean that the intersector manages to find it...) but
> > when I cycle through the retrieved NodePath and try to dynamic_cast
> > the current node to osgText::Text* it always fails, whereas it succeds
>
> > if casting is done to osg::Geode* ...so I cannot get any reference to
> > the Text object that actually was picked but just to its parent Geode.
> >
> Hi Alessandro,
>
> osg::Text is a drawable, you get it with getDrawable (or the drawable
> member of the hit, don“t know which intersector you use), not with the
> node path! A drawable is not a node!
>
> Regards,
>
> Andreas
> > Alessandro.
> >
> >
> > On 4/23/07, *Robert Osfield* < [EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>> wrote:
> >
> >     Hi Alessandro,
> >
> >     The PolytopeIntersector should work on Text, albeit with the same
> >     caveats as normal geometry w.r.t point/vs interior picking as the
> >     code isn't yet complete.
> >
> >     Robert.
> >
> >     On 4/23/07, alessandro terenzi <[EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>> wrote:
> >     > Beside the picking problem stated above, I wonder if the
> >     PolytopeIntersector
> >     > can intersect osgText::Text objects? I'd like to implement
> >     context menus so
> >     > I need to pick one of many Text objects attached to the same
> >     unique Geode,
> >     > but it looks like that the intersector retrieves just the Geode
> >     and not any
> >     > of its (text) children...is this the expected behavior?
> >     >
> >     > Thanks.
> >     > Alessandro
> >     >
> >     >
> >     > On 4/21/07, Robert Osfield <[EMAIL PROTECTED]
> >     <mailto: [EMAIL PROTECTED]>> wrote:
> >     > >
> >     > > On 4/18/07, Paul Martz <[EMAIL PROTECTED]
> >     <mailto:[EMAIL PROTECTED]>> wrote:
> >     > > > I hacked the Quick Start Guide example to draw two large
> >     quads instead
> >     > of
> >     > > > two cows and you're absolutely right! One of the quad
> >     vertices has to be
> >     > > > inside the polytope in order for picking to work. This seems
> >     like a bug
> >     > in
> >     > > > the Intersector classes. Either submit a fix, or alert
> >     Robert to this
> >     > when
> >     > > > he's back from vacation.
> >     > >
> >     > > The PolytopeIntersector is only a partial implementation which
> >     needs
> >     > > replacing with a full implementation.  An OSG user did extend
> >     it to
> >     > > work better, but didn't submit it an form ready for
> >     integration, I was
> >     > > expecting a later rev of this work, but it hasn't appeared
> >     yet.  I'll
> >     > > need to do some searching through the archives to track it
> down.
> >     > >
> >     > > Robert.
> >     > > _______________________________________________
> >     > > osg-users mailing list
> >     > > [email protected]
> >     <mailto:[email protected]>
> >     > > http://openscenegraph.net/mailman/listinfo/osg-users
> >     > > http://www.openscenegraph.org/
> >     > >
> >     >
> >     >
> >     > _______________________________________________
> >     > osg-users mailing list
> >     > [email protected] <mailto:[email protected]
> >
> >     > http://openscenegraph.net/mailman/listinfo/osg-users
> >     > http://www.openscenegraph.org/
> >     >
> >     _______________________________________________
> >     osg-users mailing list
> >     [email protected] <mailto: [email protected]
> >
> >     http://openscenegraph.net/mailman/listinfo/osg-users
> >     http://www.openscenegraph.org/
> >
> >
> >
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > osg-users mailing list
> > [email protected]
> > http://openscenegraph.net/mailman/listinfo/osg-users
> > http://www.openscenegraph.org/
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://openscenegraph.net/mailman/listinfo/osg-users
> http://www.openscenegraph.org/
>

------------------------------

_______________________________________________
osg-users mailing [EMAIL 
PROTECTED]://openscenegraph.net/mailman/listinfo/osg-usershttp://www.openscenegraph.org/




_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to