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).

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.

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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to