Re: [osg-users] PickHandler Class on Quick Start Guide

2007-11-08 Thread Robert Osfield
On Nov 8, 2007 3:24 PM, Andreas Goebel <[EMAIL PROTECTED]> wrote:
> >
> I don´t think so. It´s the osgUtil::IntersectionVisitor that´s
> deprecated.

osgUtil::IntersectVisitor is the old one that is deprecated.

osgUtil::IntersectionVisitor is the new one that exists in 1.9.x onwards.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PickHandler Class on Quick Start Guide

2007-11-08 Thread Paul Martz
> > ...except Robert has already publicly stated that the old 
> line segment 
> > and plane intersection classes are now deprecated. In light 
> of that, I 
> > would not advise developing any new code that uses them.
> >
> >   
> I don´t think so. It´s the osgUtil::IntersectionVisitor 
> that´s deprecated. The LineSegmentIntersector and 
> PlaneIntersector are both quite new and derived, like the 
> polytopeIntersector you use, from osgUtil::Intersector.

Oh, my mistake. Sorry I misunderstood. (The naming scheme is so similar
between the new and the deprecated classes, it's confusing.)

> > The best solution is to not use ShapeDrawables -- ever. 
> They are not 
> > well supported for anything other than drawing.
> >   
> The osg needs some replacement for standard-shapes like 
> included in glut. In my case, the shapeDrawables do what I 
> want, and thus I will use them!

If all you need to do is render, that's great. But there's a significant
amount of code, both in OSG and external projects that use OSG, that
dynamic_cast Drawables to Geometry objects, and if the cast fails, the code
does nothing. So, you've been warned. :-)

I think ShapeDrawables are an excellent illustration of how to derive a
custom Drawable in OSG. And, as this thread shows, they also demonstrate how
custom Drawables have their limitations.

It'd be trivial to implement sphere, cone, box, and cylinder using the
Geometry class.
   -Paul

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PickHandler Class on Quick Start Guide

2007-11-08 Thread Andreas Goebel
Paul Martz schrieb:
>>> My advice: Don't use ShapeDrawable to draw spheres. Use Geometry 
>>> instead. The osgUtil Intersector classes work with Geometry because
>>> Geometry::accept() actually contains code.
>>>-Paul
>>>   
>> Hi,
>>
>> the lineSegment-intersector and the planeIntersector definitely work 
>> with shapeDrawables. For picking spheres in a scene I would use a 
>> lineSegmentIntersector.
>> As for the polytopeIntersector in the example-code I don´t know, I 
>> haven´t tried that.
>> 
>
> ...except Robert has already publicly stated that the old line segment and
> plane intersection classes are now deprecated. In light of that, I would not
> advise developing any new code that uses them.
>
>   
I don´t think so. It´s the osgUtil::IntersectionVisitor that´s 
deprecated. The LineSegmentIntersector and PlaneIntersector are both 
quite new and derived, like the polytopeIntersector you use, from 
osgUtil::Intersector.
> The best solution is to not use ShapeDrawables -- ever. They are not well
> supported for anything other than drawing.
>   
The osg needs some replacement for standard-shapes like included in 
glut. In my case, the shapeDrawables do what I want, and thus I will use 
them!


Reagards,

Andreas
>-Paul
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>   

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PickHandler Class on Quick Start Guide

2007-11-08 Thread Paul Martz
> > My advice: Don't use ShapeDrawable to draw spheres. Use Geometry 
> > instead. The osgUtil Intersector classes work with Geometry because
> > Geometry::accept() actually contains code.
> >-Paul
> Hi,
> 
> the lineSegment-intersector and the planeIntersector definitely work 
> with shapeDrawables. For picking spheres in a scene I would use a 
> lineSegmentIntersector.
> As for the polytopeIntersector in the example-code I don´t know, I 
> haven´t tried that.

...except Robert has already publicly stated that the old line segment and
plane intersection classes are now deprecated. In light of that, I would not
advise developing any new code that uses them.

The best solution is to not use ShapeDrawables -- ever. They are not well
supported for anything other than drawing.
   -Paul

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PickHandler Class on Quick Start Guide

2007-11-07 Thread Andreas Goebel
Paul Martz schrieb:
>  
>
> My advice: Don't use ShapeDrawable to draw spheres. Use Geometry 
> instead. The osgUtil Intersector classes work with Geometry because 
> Geometry::accept() actually contains code.
>-Paul
Hi,

the lineSegment-intersector and the planeIntersector definitely work 
with shapeDrawables. For picking spheres in a scene I would use a 
lineSegmentIntersector.
As for the polytopeIntersector in the example-code I don´t know, I 
haven´t tried that.


Regards,

Andreas
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PickHandler Class on Quick Start Guide

2007-11-07 Thread Paul Martz
 

Sorry, Paul. I didn't understand what you said in your last email about
trying to pick a Drawable that isn't Geometry. What do you mean by that? My
shapes are ShapeDrawables that are connected to a Geode and then to a
MatrixTransform.  

If you are trying to pick a ShapeDrawable, then you are trying to pick a
Drawable that isn't a Geometry. ShapeDrawable and Geometry both derive from
Drawable, therefore ShapeDrawable is a Drawable but is not a Geometry.

I honestly have no idea on where to begin to derive my own intersector...
Can you give me a hand? Thanks. 

First, I apologize. Ignore my previous post, which said you needed to create
a new Intersector to intersect a ShapeDrawable. I was wrong. In fact, the
current Intersector classes in osgUtil are fine. The problem is entirely
with ShapeDrawable.
 
Here's your problem: 
 
void ShapeDrawable::accept(ConstAttributeFunctor&) const
{
}
 
That's ShapeDrawable.cpp, about line 1805. Compare that to the definition of
Geometry::accept(), which actually does something.
 
I'm not sure Robert ever intended ShapeDrawables to be used in anything
other than examples, perhaps he can comment. Certainly when Robert added the
new intersection classes in osgUtil, he did not implement this necessary
method in ShapeDrawable.
 
My advice: Don't use ShapeDrawable to draw spheres. Use Geometry instead.
The osgUtil Intersector classes work with Geometry because
Geometry::accept() actually contains code.
   -Paul
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PickHandler Class on Quick Start Guide

2007-11-07 Thread Renan Mendes
Sorry, Paul. I didn't understand what you said in your last email about
trying to pick a Drawable that isn't Geometry. What do you mean by that? My
shapes are ShapeDrawables that are connected to a Geode and then to a
MatrixTransform.

I honestly have no idea on where to begin to derive my own intersector...
Can you give me a hand? Thanks.

Renan M Z Mendes

2007/11/6, Paul Martz <[EMAIL PROTECTED]>:
>
>  If you're trying to pick a Drawable that isn't a Geometry, unmodified OSG
> won't pick it. You'll need to derive your own Intersector class to perform
> picking on custom Drawables.
>-Paul
>
>
>  --
> *From:* [EMAIL PROTECTED] [mailto:
> [EMAIL PROTECTED] *On Behalf Of *Renan Mendes
> *Sent:* Tuesday, November 06, 2007 4:52 PM
> *To:* OpenSceneGraph Users
> *Subject:* Re: [osg-users] PickHandler Class on Quick Start Guide
>
> Hi, Paul.
>
>I do have the complete version. You had already given me the address to
> download some time ago.
>
>   Well, I have just made some tests. I've create a simple method (just to
> print a prompt message) when the node was mouse picked, but it didn't work.
> Do you think that's because my Point class instances are matrix and not
> shapes? How can I adapt your code for that objective?
>
>Thanks again.
>
>
>Renan M Z Mendes
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PickHandler Class on Quick Start Guide

2007-11-06 Thread Paul Martz
If you're trying to pick a Drawable that isn't a Geometry, unmodified OSG
won't pick it. You'll need to derive your own Intersector class to perform
picking on custom Drawables.
   -Paul
 


  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Renan
Mendes
Sent: Tuesday, November 06, 2007 4:52 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] PickHandler Class on Quick Start Guide


Hi, Paul.

   I do have the complete version. You had already given me the address to
download some time ago.

  Well, I have just made some tests. I've create a simple method (just to
print a prompt message) when the node was mouse picked, but it didn't work.
Do you think that's because my Point class instances are matrix and not
shapes? How can I adapt your code for that objective? 

   Thanks again.


   Renan M Z Mendes


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PickHandler Class on Quick Start Guide

2007-11-06 Thread Renan Mendes
Hi, Paul.

   I do have the complete version. You had already given me the address to
download some time ago.

  Well, I have just made some tests. I've create a simple method (just to
print a prompt message) when the node was mouse picked, but it didn't work.
Do you think that's because my Point class instances are matrix and not
shapes? How can I adapt your code for that objective?

   Thanks again.


   Renan M Z Mendes
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PickHandler Class on Quick Start Guide

2007-11-06 Thread Paul Martz
Hi Renan -- Sounds like maybe you don't have the complete source? You can
download it from here: http://www.skew-matrix.com/OSGQSG/index.html
 
You say calling the method in _selectedNode "doesn't seem to work very well"
but you haven't told me how it fails so that's tough to diagnose. Does it
compile? If so, does it crash because the pointer is NULL? 
 
You said your sphere was a "shape". Do you mean a ShapeDrawable? If so, I
believe the Intersector classes are limited to picking Geometry classes...
not sure, check the code.
 
Hope that helps,
 
Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com <http://www.skew-matrix.com/> 
303 859 9466
 


  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Renan
Mendes
Sent: Tuesday, November 06, 2007 4:15 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] PickHandler Class on Quick Start Guide


Hi, there, Paul.

 I have tried to adapt your PickHandler class to solve my specific
problem, but I couldn't. Please, help me out. Honestly I haven't completely
understand it (when you check for Intersections and stuff like this) but I
imagined that all I had to do was to put my own methods after the "if
(_selectedNode.valid())" condition.

 Well, let me elaborate a little bit more on my software's current
situation.

 There is a Point class, that is osg::MatrixTransform's daughter. Each
Point's instance has a geode child, which carries a sphere with a certain
color. What I need to do is change the sphere's color after this shape was
selected by mouse picking. I've tried creating a method changeColor, that
belonged to the Point class, and I've made the PickHandler a daughter of
that class, so that it would have access to the method. 
 Specifics of the method aside, what do I have to do to call that
method? Is it simply by writing "_selectedNode->changeColor();" in the above
mentioned condition's nest? That doesn't seem to work very well Do I
have to declare _selectedNode as a global variable before the definition of
the class? If yes, what kind o pointer would it be? 

 By answering this, you'll make someone eternally grateful to you!

Renan M Z Mendes


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PickHandler Class on Quick Start Guide

2007-11-06 Thread Renan Mendes
Hi, there, Paul.

 I have tried to adapt your PickHandler class to solve my specific
problem, but I couldn't. Please, help me out. Honestly I haven't completely
understand it (when you check for Intersections and stuff like this) but I
imagined that all I had to do was to put my own methods after the "if
(_selectedNode.valid())" condition.

 Well, let me elaborate a little bit more on my software's current
situation.

 There is a Point class, that is osg::MatrixTransform's daughter. Each
Point's instance has a geode child, which carries a sphere with a certain
color. What I need to do is change the sphere's color after this shape was
selected by mouse picking. I've tried creating a method changeColor, that
belonged to the Point class, and I've made the PickHandler a daughter of
that class, so that it would have access to the method.
 Specifics of the method aside, what do I have to do to call that
method? Is it simply by writing "_selectedNode->changeColor();" in the above
mentioned condition's nest? That doesn't seem to work very well Do I
have to declare _selectedNode as a global variable before the definition of
the class? If yes, what kind o pointer would it be?

 By answering this, you'll make someone eternally grateful to you!

Renan M Z Mendes
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PickHandler Class on Quick Start Guide

2007-10-10 Thread Renan Mendes
I'l check into that. Thank you, Paul.

Renan
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PickHandler Class on Quick Start Guide

2007-10-10 Thread Paul Martz
The code shown in the book is just a snippet. You should download and
compile the full examples from the book's Web site.
http://www.skew-matrix.com/OSGQSG/
 
Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com <http://www.skew-matrix.com/> 
303 859 9466
 


  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Renan
Mendes
Sent: Wednesday, October 10, 2007 4:42 AM
To: OSG Mailing List
Subject: [osg-users] PickHandler Class on Quick Start Guide


I think some kind of error occurred when I've tried to send this message to
the mailing list, so just to be sure, here it is again:


Hello again, everyone.

I've got another question on EventHandlers, but specifically on the
PickHandler class that was shown on the Quick Start Guide (please reference
to this book as to understand my question, pages 101-104 (115 of the PDF
file)) 

So that I could learn a little bit more about the subject I've tried simply
copying the class and the main function to a .cpp file, then I've created a
simple scene and have tried to compile this code.

The error messages were abundant but they were all related in some way to
_selectedNode. Is this identifier correct? Am I missing the point here
somewhere? I mean, is this the place where I should write something of my
own? 

Sorry if my questions are too obvious, but I really couldn't figure it out
after reading and re-reading...

Renan M Z Mendes


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] PickHandler Class on Quick Start Guide

2007-10-10 Thread Renan Mendes
I think some kind of error occurred when I've tried to send this message to
the mailing list, so just to be sure, here it is again:


Hello again, everyone.

I've got another question on EventHandlers, but specifically on the
PickHandler class that was shown on the Quick Start Guide (please reference
to this book as to understand my question, pages 101-104 (115 of the PDF
file))

So that I could learn a little bit more about the subject I've tried simply
copying the class and the main function to a .cpp file, then I've created a
simple scene and have tried to compile this code.

The error messages were abundant but they were all related in some way to
_selectedNode. Is this identifier correct? Am I missing the point here
somewhere? I mean, is this the place where I should write something of my
own?

Sorry if my questions are too obvious, but I really couldn't figure it out
after reading and re-reading...

Renan M Z Mendes
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org