Thank you for quick answers Brede and John!
I used the option preserveFace and now it works. 

Best regards,

-----Ursprungligt meddelande-----
Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] För Brede Johansen
Skickat: den 17 juni 2008 09:42
Till: OpenSceneGraph Users
Ämne: Re: [osg-users] Problem to get textures from a .flt model

Hi Åsa,

The OpenFlight face attributes are initially attached to the face geode.  If 
you rely on the original structure of the .flt file you should disable the post 
optimizer in the OpenFlight reader with the reader option preserveFace.


On Tue, Jun 17, 2008 at 8:24 AM, Engvall Åsa <[EMAIL PROTECTED]> wrote:
> Hi everybody!
> I am new to OSG and this is my first posting to OSG users.
> I have some problems to retrieve the textures from a .flt model and 
> would like to know what I'm doing wrong.
> In main, the model is loaded in this way:
> osg::Group* Ground = dynamic_cast<osg::Group*>
> (osgDB::readNodeFile("C:/Program/Multigen-Paradigm/creator_3_2/tutoria
> ls/DesktopTutor/Models/arena.flt"));
> I use a node visitor to find all geodes in the scenegraph "Ground" and 
> the apply function looks like this:
>         for (unsigned int i=0; i<currentGeode.getNumDrawables(); ++i)
>         {
>                 osg::StateSet* StateSet = 
> (currentGeode.getDrawable(i))->getStateSet();
>                 osg::Texture* Texture = dynamic_cast<osg::Texture*> 
> (StateSet->getTextureAttribute(0, osg::StateAttribute::TEXTURE));
>                 --- modify the texture ---
>         }
> The node visitor is executed and counts the drawables, but the 
> function
> getStateSet() returns the null pointer. If I use getOrCreateStateSet() 
> instead, an empty StateSet is created. What should I do to retrieve 
> the textures?
> _______________________________________________
> osg-users mailing list
> org
osg-users mailing list
osg-users mailing list

Reply via email to