[osg-users] OSG RECIPES Data

Wang Rui wangray84 at gmail.com
Tue Apr 14 18:55:46 PDT 2015


Hi Dave,


One of the purpose of the osgRecipes project is to provide all source code used in the book OpenSceneGraph 3.0 Cookbook, published by Packt Publishing. And what you found is just corresponding to the second example in Chapter 5. And it should be a mistake... The correct code snippet, as shown in the book, is as below:
image = osgDB::readImageFile( "0.ffmpeg", new osgDB::Options("format=vfwcap frame_rate=25") );


It in fact uses the FFmpeg plugin to load video stream from the webcam using the VFW option. You may change the filename to some other disk files like "c:/path/file.avi.ffmpeg" and then ignore the option string. But there is no "animate PNG" support in OSG... so sorry for the misdirection. :-)


Also thank you for supporting the osgRecipes project.


Wang Rui


------------------ Original ------------------
From:  "Dave Sargrad";<davidsargrad at hotmail.com>;
Date:  Wed, Apr 15, 2015 05:42 AM
To:  "osg-users"<osg-users at lists.openscenegraph.org>; 

Subject:  [osg-users] OSG RECIPES Data



Hi,

I've found the osgRecipes  (https://github.com/xarray/osgRecipes) to be quite useful. However most of the data is missing from these, and there is no proper reference to the location of the data. I stumbled on this (https://github.com/openscenegraph/osg-data) data. It seems to be a close fit to the recipes. However some data files are missing. For example right now I'm in cookbook_05_02. This cookbook is looking for one of two datafiles (in my case pic.png). I think this is just a placeholder, and I'm expected to drop my own "animated PNG" into place. I've tried several such png's found on the web, but none seem to do what one might expect.


Code:
 osg::ref_ptr<osg::Image> image;
    if ( arguments.argc()>1 )
        image = osgDB::readImageFile( arguments[1] );
    else
    {
#ifdef WIN32
        image = osgDB::readImageFile( "Images/bouncing_beach_ball.png" );
#else
        image = osgDB::readImageFile( "/dev/video0.ffmpeg" );
#endif
    }
    
    osg::ImageStream* imageStream = dynamic_cast<osg::ImageStream*>( image.get() );
    if ( imageStream ) imageStream->play();



I've never used animated png's before so I'm not sure how best to find a compatible image.

In this code snippet, I replaced pic.png with a bouncing_beach_ball.png found here (http://upload.wikimedia.org/wikipedia/commons/1/14/Animated_PNG_example_bouncing_beach_ball.png).

Thank you for any insights.

Cheers,
Dave

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=63394#63394





_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20150415/9743a5a2/attachment-0007.htm>


More information about the osg-users mailing list