Re: [osg-users] BUG REPORT: LineSegmentIntersector

2010-03-26 Thread Robert Osfield
Hi Sean,

On Thu, Mar 25, 2010 at 7:34 PM, Sean Spicer sean.spi...@aqumin.com wrote:
 I came across a nasty little bug today:

 (a) Create an osg::Geometry and assign a vertex array that is an 
 osg::Vec4Array
 (b) Try to pick with a LineSegmentIntersector
 (c) CRASH

Ouch.

 Digging a little bit, it looks like LineSegmentIntersector assumes
 that vertex arrays are always of type osg::Vec3Array.  Are there any
 plans to change this ?  It looks like a tedious, but not terribly
 invasive change.

I don't personally have plans right now, Vec3Array is the usual way to
handle vertex data in OSG/OpenGL.   The code certainly shouldn't crash
though and we need to address this right away.

Handling other data types for vertices would be one better than just
fixing the crash.  I'm open to suggestions, especially if others are
willing to pitch in and help code them up ;-)

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


[osg-users] BUG REPORT: LineSegmentIntersector

2010-03-25 Thread Sean Spicer
I came across a nasty little bug today:

(a) Create an osg::Geometry and assign a vertex array that is an osg::Vec4Array
(b) Try to pick with a LineSegmentIntersector
(c) CRASH

Digging a little bit, it looks like LineSegmentIntersector assumes
that vertex arrays are always of type osg::Vec3Array.  Are there any
plans to change this ?  It looks like a tedious, but not terribly
invasive change.

sean
_
Sean Spicer
Executive Vice President  Chief Technology Officer
Aqumin (www.aqumin.com)
Office+1.713.781.2121
Mobile...+1.713.447.2706
Fax...+1.713.781.2123
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] BUG REPORT: LineSegmentIntersector

2010-03-25 Thread Jason Daly

Sean Spicer wrote:

I came across a nasty little bug today:

(a) Create an osg::Geometry and assign a vertex array that is an osg::Vec4Array
(b) Try to pick with a LineSegmentIntersector
(c) CRASH

Digging a little bit, it looks like LineSegmentIntersector assumes
that vertex arrays are always of type osg::Vec3Array.  Are there any
plans to change this ?  It looks like a tedious, but not terribly
invasive change.
  


Interesting find, Sean...

My first reaction is, Why would you ever use a Vec4Array for vertex 
coordinates?!, but an equally valid counter-argument would be that 
OpenGL allows 4-element vertices them, so OSG should support them.


Next, you have to ask how to intersect a line segment with a geometry 
with Vec4Array vertices.  Would you have to do the w-divide on the 
vertices before you did the intersection tests to be correct, or is it 
more correct to not do it, or do you have to do the modelview transform, 
then the w-divide, then the intersection...


Then, you have to start wondering if there are any other assumptions 
like this being made anywhere (I found other possible cases in 
Tessellator and Optimizer, though it looks as if they just bail out 
instead of crashing when they don't find a Vec3Array).


I think you may have opened a can of worms here  :-)

--J

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


Re: [osg-users] BUG REPORT: LineSegmentIntersector

2010-03-25 Thread Sean Spicer
Without giving away too much IP, one of the reasons why one might want
to think about using Vec4Arrays is to take advantage of host-side SIMD
operations - which commonly use 128bit registers (4 floats).

I agree, this is a can of worms.

sean
_
Sean Spicer
Executive Vice President  Chief Technology Officer
Aqumin (www.aqumin.com)
Office+1.713.781.2121
Mobile...+1.713.447.2706
Fax...+1.713.781.2123



On Thu, Mar 25, 2010 at 2:53 PM, Jason Daly jd...@ist.ucf.edu wrote:
 Sean Spicer wrote:

 I came across a nasty little bug today:

 (a) Create an osg::Geometry and assign a vertex array that is an
 osg::Vec4Array
 (b) Try to pick with a LineSegmentIntersector
 (c) CRASH

 Digging a little bit, it looks like LineSegmentIntersector assumes
 that vertex arrays are always of type osg::Vec3Array.  Are there any
 plans to change this ?  It looks like a tedious, but not terribly
 invasive change.


 Interesting find, Sean...

 My first reaction is, Why would you ever use a Vec4Array for vertex
 coordinates?!, but an equally valid counter-argument would be that OpenGL
 allows 4-element vertices them, so OSG should support them.

 Next, you have to ask how to intersect a line segment with a geometry with
 Vec4Array vertices.  Would you have to do the w-divide on the vertices
 before you did the intersection tests to be correct, or is it more correct
 to not do it, or do you have to do the modelview transform, then the
 w-divide, then the intersection...

 Then, you have to start wondering if there are any other assumptions like
 this being made anywhere (I found other possible cases in Tessellator and
 Optimizer, though it looks as if they just bail out instead of crashing when
 they don't find a Vec3Array).

 I think you may have opened a can of worms here  :-)

 --J

 ___
 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] BUG REPORT: LineSegmentIntersector

2010-03-25 Thread Sean Spicer
Looking at osg::State::setVertexPointer(const Array *array), I see
that the stride parameter is always 0.  If we relaxed this
constraint, and allowed an Array to have a stride, I might be able to
overcome the problem I am working on.  Any comments on what impact
this might have ?

Also, in order to accomplish what I'm after, I'd need a mechanism to
allocate the underlying array on a 16 byte boundary.  It looks as if
this should be easily doable as MixinVector is a std::vector.  Any
thoughts on this?

sean
_
Sean Spicer
Executive Vice President  Chief Technology Officer
Aqumin (www.aqumin.com)
Office+1.713.781.2121
Mobile...+1.713.447.2706
Fax...+1.713.781.2123



On Thu, Mar 25, 2010 at 3:05 PM, Sean Spicer sean.spi...@aqumin.com wrote:
 Without giving away too much IP, one of the reasons why one might want
 to think about using Vec4Arrays is to take advantage of host-side SIMD
 operations - which commonly use 128bit registers (4 floats).

 I agree, this is a can of worms.

 sean
 _
 Sean Spicer
 Executive Vice President  Chief Technology Officer
 Aqumin (www.aqumin.com)
 Office+1.713.781.2121
 Mobile...+1.713.447.2706
 Fax...+1.713.781.2123



 On Thu, Mar 25, 2010 at 2:53 PM, Jason Daly jd...@ist.ucf.edu wrote:
 Sean Spicer wrote:

 I came across a nasty little bug today:

 (a) Create an osg::Geometry and assign a vertex array that is an
 osg::Vec4Array
 (b) Try to pick with a LineSegmentIntersector
 (c) CRASH

 Digging a little bit, it looks like LineSegmentIntersector assumes
 that vertex arrays are always of type osg::Vec3Array.  Are there any
 plans to change this ?  It looks like a tedious, but not terribly
 invasive change.


 Interesting find, Sean...

 My first reaction is, Why would you ever use a Vec4Array for vertex
 coordinates?!, but an equally valid counter-argument would be that OpenGL
 allows 4-element vertices them, so OSG should support them.

 Next, you have to ask how to intersect a line segment with a geometry with
 Vec4Array vertices.  Would you have to do the w-divide on the vertices
 before you did the intersection tests to be correct, or is it more correct
 to not do it, or do you have to do the modelview transform, then the
 w-divide, then the intersection...

 Then, you have to start wondering if there are any other assumptions like
 this being made anywhere (I found other possible cases in Tessellator and
 Optimizer, though it looks as if they just bail out instead of crashing when
 they don't find a Vec3Array).

 I think you may have opened a can of worms here  :-)

 --J

 ___
 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] BUG REPORT: LineSegmentIntersector

2010-03-25 Thread Jason Daly

Sean Spicer wrote:

Without giving away too much IP, one of the reasons why one might want
to think about using Vec4Arrays is to take advantage of host-side SIMD
operations - which commonly use 128bit registers (4 floats).

I agree, this is a can of worms.
  



Mmmm, yes, I suppose that would be a compelling reason.

--J

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