Hi Franclin,

the code you're using looks correct.

I believe we can ignore ShapeDrawables for now as they're not part of this problem (but they are a problem onto itself apparently...)

What exactly is the error you're seeing?  Is it
a) 'geometryd' is 0 (what do you mean by 'dangling'? In my understanding it's a valid pointer i.e. !=0 but broken)
b) the texture coordinate pointer 'tc' is 0?
c) none of the above, please describe

Since you're loading a .3ds file I would assume you're actually getting a proper Geometry object (since the loader only creates Geometry and not ShapeDrawable or Text).

If it's b) then the Drawable you're looking at maybe doesn't have texture coordinates? If the object is indeed textured (on screen) then maybe they are generated using TexGen?

Cheers,
/ulrich

Franclin Foping wrote:
I would like to retrieve the texture and normal coordinates of a loaded model. But not sure how to do it. My first attempt was to use a visitor to traverse the node, retrieve its Drawable objects, convert them to Geometry and finally extract texture coordinates but unfortunately, it doesn't work.
...
const osg::Geometry* geometryd = dynamic_cast<const osg::Geometry*> (draw);
   // geometryd is dangling !!!
            if (geometryd)
            const osg::Array* tc = geometryd->getTexCoordArray(0);
         }
       }
 };
  osg::Node* myNode = osgDB::readNodeFile("my3DModel.3ds");
 myVisitor visit;
  myNode->accept (visit);
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to