[osg-users] RE : Re: Getting texture coordinates of loaded models

Alberto Luaces aluaces at udc.es
Thu Jul 31 06:45:06 PDT 2008


El Jueves 31 Julio 2008ES 14:33:30 Franclin Foping escribió:
>  visitorto retrieve its Drawable objects, turn them into Geometry objects
> and use your trick but I was wrong as it is impossible to convert from
> Drawable to Geometry.

You still don't get it. You are not converting one type to another, but the 
pointers that reference those objects. This is only possible if the object 
pointed is really of the type you are requesting. I have been doing this a 
zillion times until now, provided that I know beforehand that my meshes are 
stored as Geometry(s).

As you have been recommended, it's important that you know how polymorphism 
works in C++ and the rest of OO languages. Then you will understand why you 
can't magically convert one object of one class to another.

As for the retrieval of the UV coordinates of a ShapeDrawable, they are 
hard-wired directly into the code, so I'm afraid you'll have to read OSG code 
to find how they are calculated (ShapeDrawable.cpp). The good news is that you 
won't have to do this work at runtime anymore :)


More information about the osg-users mailing list