Hi,

I'm quite new to OSG, and I don't get why my (very (very)) simple code crashes :

[main.cpp]

#include <osg/Shape>
#include <osg/ShapeDrawable>
#include <osg/Geode>
#include <osgViewer/Viewer>


int main(int argc, char *argv[]) {
    osg::Group* root = new osg::Group;
    
    osg::Geode* geode = new osg::Geode();

    geode->addDrawable(new osg::ShapeDrawable(new 
osg::Sphere(osg::Vec3(0.,0.,0.), 1.)));
    
    root->addChild( geode );
    
    osgViewer::Viewer viewer;

    viewer.setSceneData( root );
    
    viewer.realize();
    
    while( !viewer.done() )
        viewer.frame();
    
    return 0;
}

I run :

g++ -c main.cpp

and then

g++ -o sphere main.o -losg -losgViewer

So far, everything goes well. Then, when I type :

./sphere

the app crashes without displaying any sphere, and yielding :

Bus error: 10

But when I want to display a .3ds mesh, it works perfectly well.

I am under Mac OS X Lion (10.7), and I compiled OSG myself.

What's wrong? ;(
Please help

Thank you

Yann
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to