Hi Robert

I have checked to see if I get a NULL value back but the segmentation
fault seems to be within the osgDB::readImageFile.

I currently trying to debug and step through the code until the error
but I've had little success so far.

I tried to simplify the code and just play the movie, no keyboard or
mouse entries or anything.But the code does not even get to my check to
see if the result is NULL or not.

So based on the osgMovie class:

my main code is as follows (missing the argument passing)
int main(int argc, char** argv)
{
    bool useTextureRectangle = true;


    osgProducer::Viewer viewer;

    viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS);

    osg::ref_ptr<osg::Geode> geode = new osg::Geode;
    osg::Vec3 pos(0.0f,0.0f,0.0f);
        
    osg::StateSet* stateset = geode->getOrCreateStateSet();
    stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);


    osg::Image* image
=osgDB::readImageFile("/home/tmcmillan/Desktop/Africa.avi");
   
    if (image == NULL)
    {
        cout << " Image is NULL" << endl;
    }
    else
    {
        cout << " Loaded image " << endl;
    }

    osg::ImageStream* imagestream =
dynamic_cast<osg::ImageStream*>(image);
    if (imagestream) imagestream->play();
    if (image)
    {

geode->addDrawable(myCreateTexturedQuadGeometry(pos,image->s(),image->t(),image,useTextureRectangle));
        pos.z() += image->t()*1.5f;
    }  
    else
    {
        std::cout<<"Unable to read file "<<std::endl;
    }            

    if (geode->getNumDrawables()==0)
    {
        // nothing loaded.
        cout << "No data loaded" << endl;
        return 1;
    }

    // pass the model to the MovieEventHandler so it can pick out
ImageStream's to manipulate.
///    meh->set(geode.get());


    // set up a post swap callback to flush deleted GL objects and
compile new GL objects            
    for(unsigned int cameraNum=0;cameraNum<viewer.getNumberOfCameras();
++cameraNum)
    {
        Producer::Camera* camera=viewer.getCamera(cameraNum);
        camera->addPostSwapCallback(new PostSwapFinishCallback());
    }

    viewer.setSceneData(geode.get());

    // create the windows and run the threads.
    viewer.realize();

    while( !viewer.done() )
    {
        
        viewer.sync();
        viewer.update();
        viewer.frame();
    }
    
    viewer.sync();
    return 0;
}


On Mon, 2007-03-05 at 13:53 +0000, Robert Osfield wrote:
> Hi Tristan,
> 
> You should be able to use osgDB::readImageFile without argument
> parser, and without options be passed in.  Perhaps you readImageFile
> is returning null, but you are later using it anyway, always check for
> the value that it returns.
> 
> Also try enabling verbose debug output by setting the env var
> OSG_NOTIFY_LEVEL to DEBUG and then run your app, this will give you a
> bit more info.
> 
> Robert.
> 
> On 3/5/07, Tristan McMillan <[EMAIL PROTECTED]> wrote:
> > Hi OSG-Community
> >
> > I have tried to remove the argument parsing from the osgMovie example as
> > I don't want to use the command line. However I keep getting a
> > segmentation fault when I try to read my .avi file, using the following
> > line:
> >
> > osg::Image* image =
> > osgDB::readImageFile("/home/tmcmillan/Desktop/Africa.avi");
> >
> > However this seg faults sine I believe the DB does not recognize
> > the .avi extestion. I thought this would work as this seems to be what
> > the argument from the command line is passed to the readImageFile class.
> >
> > But my knowledge regarding argument passing is still nowhere above
> > novice.
> >
> > So I did some digging and thought I should used the following method:
> > sg::Image*  readImageFile(const std::string& filename,const
> > ReaderWriter::Options* options);
> >
> > However I'm unsure how to link the xine plugin to the 'options'.
> >
> > Thanks
> > Tristan
> >
> > _______________________________________________
> > osg-users mailing list
> > [email protected]
> > http://openscenegraph.net/mailman/listinfo/osg-users
> > http://www.openscenegraph.org/
> >
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://openscenegraph.net/mailman/listinfo/osg-users
> http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to