Hi Josue,

When using osg::ref_ptr, you should test for escena.valid() to know whether
the file was loaded or not.
 if (!escena.valid()){

               cout<<"No estoy leyendo"<<endl;
               exit(0);}

Mourad



On Wed, Mar 9, 2011 at 6:33 PM, Josue Hernandez <[email protected]> wrote:

> Hi, for some reason I do not understand i can load fbx files, this is my
> code
>
> ...
> // Inclusi'on de cabeceras de OSG necesarias
> #include <osg/Node>
> #include <osg/Group>
> #include <osgDB/ReadFile>
> #include <osgDB/WriteFile>
> #include <osgViewer/Viewer>
> //#include <osgWidget/Widget>
> #include <iostream>
> using namespace std;
> int main()
> {
> //      osgViewer "pruba.fbx";
> // Carga/creaci'on y configuraci'on de la escena
>        //osg::Group* node = new osg::Group();
>        //osg::Node* node=new osg::Node();
>        cout<<"letrero 1"<<endl;
>        //osg::ref_ptr<osg::Node> escena= osgDB::readNodeFile("Lerpz.fbx");
>        osg::Node* escena = osgDB::readNodeFile("Samuel.fbx");
>        if (!escena){
>                cout<<"No estoy leyendo"<<endl;
>                exit(0);}
>        //osgDB::writeNodeFile(*escena.get(), "copfbx.osg");
>        //osg::Node* escena = osgDB::readNodeFile("cow.osg");
>        cout<<"letrero 1"<<endl;
>        cout<<"letrero 1"<<endl;
>        cout<<"letrero 1"<<endl;
>        cout<<"letrero 1"<<endl;
>        cout<<"letrero 1"<<endl;
>        cout<<"letrero 1"<<endl;
>        //osgWidget::point_type w =
> view->getCamera()->getViewport()->width();
> // Creaci'on y configuraci'on del visor
>        osgViewer::Viewer visor;
>        //visor.setSceneData(node);
>        visor.setSceneData(escena);
>
> // Corrida del ciclo para el recorrido (actualizaci'on y dibujo) de la
> escena
>        return visor.run();
>
>
> }
>
> when enter in the if, it is verifiest that the node "escena" has been
> loaded with the fbx file, but does not. what can be the problem?
>
> Thank you!
>
> Cheers,
> Josue
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=37472#37472
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to