-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Danny Lesnik wrote:
> Hi,
> <snip>

Try this:


class MyThread : public OpenThreads::Thread
{
public:
        MyThread(osg::Node** node) :
                _node(node) {}

        virtual ~MyThread() {}

        virtual void run() {
                *_node = osgDB::readNodeFile("cow.osg");
        }

protected:
        osg::Node**     _node;
};

int main() {
        volatile        osg::Node*              node = NULL;
                        osg::Group*             root = new osg::Group();

        MyThread*       myThread = new MyThread(&node);

        myThread->start();

        while(!node) {
                sleep(100);
        }

        root->addChild(node);

        osgViewer::Viewer viewer;

        root->addChild(node);
        viewer.setSceneData( root );

        viewer.addEventHandler(new osgViewer::ThreadingHandler);

        while(!viewer.done()) {
                //...
        }
}


Not tested, but should be close to it.

- --
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFLeI5pT9LetA9XoXwRAsL9AJ91SX8irnTIw7QRMLouj4zRZeYc0gCfW13U
EUqaHo9pHWRNWQqkbPhEFeY=
=scVX
-----END PGP SIGNATURE-----
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to