Hi again,

I added this line to my code and now I don't get the weird crash.

viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);

Don't know why, but it work :)

Thank you for your help

Alex


Hi Alexandre,

> Hi Art,
>
> yes, the rest of my setup is exactly like you said :
>
> osgPPU::Processor->addChild(videoUnitTexture);
> videoUnitTexture->addChild(anotherUnit);
> It works great if I load a simple image (.png) rather than
> a video file (.mov).
>
Hmm, and the processor is also added to the scene graph?


I have uploaded a simple video example, which shows how to use osgPPU to
perform some video processing. In the example the video is just modified during
the rendering to show in greyscale mode. Other filters are of course possible.
Take a look.


> Also I checked if the video streaming works well when apply
> to a model
> in a scene and it does render correctly.
>
>
> I tried another way with my own video streaming class that
> look like this :
>
>   ...
>
>   osg::Texture2D* texture = new osg::Texture2D();
>   texture->setDataVariance( osg::object::DYNAMIC );
>
>   osgPPU::UnitTexture * videoUnitTexture = new
> osgPPU::UnitTexture( texture );
>
>   ...
>
>   while( !viewer.done() )
>   {
>     // Update the texture image in the main render loop
>     osg::Image* image =
> myOwnStreamingClass->getNextFrameToDisplay();
>     texture->setImage( image );
>
>     viewer.frame();
>   }
>
> This way it works fine for a while, but after a certain
> time (random),
> the application crash with an unhandle exception.
>
I do not know, why the application crashes. Maybe some memory leaks in the
image streaming class. Have you also tried your streamer without osgPPU.

I would say get the newest version of osgPPU from the svn. Maybe the small
changes I have made would help you to solve the problem.


Sometimes there are also crashes or strange behaviour if using osg and osgPPU
together. It happens if osgPPU tries to access textures which haven't applied
through osg before. Such a texture has no valid properties, i.e. texture size,
which makes the osgPPU do not handle in a proper way. I have tried to make the
osgPPU's code more or less stable against such wrong usage, however this might
still happen if osgPPU is used wrong.
This problem is very hard solvable, because of this strict behaviour of osg to
load and to initialize all the data after they had been applied. I hate this,
it doesn't make my life easier at all ;(
Hence try to use osgPPU as it has been shown in all the examples and you won't
get any troubles.


Best regards,
Art


P.S. If nothing helps, then provide me with the info output
(OSG_NOTIFY_LEVEL=info), so that one can see the osgPPU's output information.


> So I'm a little confuse with all this stuff, hope you
> can help me.
>
> Thank you
>
> Alexandre
>
>
>
> Hi Alexandre,
>
> > Hi,
> >
> > I want to use osgPPU::UnitTexture to shoot a video as
> a texture input for
> > another unit.
> >
> Ok, good idea, I have used it for my project successfully.
>
> > So I tried this code :
> >
> > Image * myVideo = osgDB::readImageFile(
> "myVideoFile.mov" );
> >
> > osg::ImageStream * videoStream_ = NULL;
> > videoStream_ = dynamic_cast<osg::ImageStream*>(
> myVideo );
> > videoStream_->setLoopingMode(
> osg::ImageStream::LOOPING );
> >
> >  if( videoStream_ )
> >        videoStream_->play();
> >
> > osg::Texture2D* texture = new osg::Texture2D();
> > texture->setImage(myVideo);
> >
> > osgPPU::UnitTexture * videoUnitTexture = new
> osgPPU::UnitTexture( texture
> > );
> >
> > .... and then plug it in the unit pipeline
> >
> How is the rest of your setup. It should be something like
> this:
>
> osgPPU::Processor->addChild(videoUnitTexture);
> videoUnitTexture->addChild(anotherUnit);
>
> >
> >
> > But this doesnt work, the texture input in my other
> module is always black.
> >
> I'll try tomorrow a simple example and let you know if
> you need some extra
> setup. There were a lot of changes since the last use of
> video processing
> through osgPPU.
>
> > Is my code wrong ? If no, what is the way to do that
> with osgPPU
> >
> Could you check if the video streaming do work at all? I
> mean it could be that
> the file is just not streamed properly. Try to set the
> texture to some model in
> the scene and see if the texture changes during the
> rendering.
>
> > Is this the good place to post for osgPPU ?
> >
> I think yes, if nobody complains ;).  There is no extra
> mailinglist for
> osgPPU.
>
>
> Best regards,
> Art
>
> > Thank you
> >
> > Alexandre
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to