I've been trying to find a way to get movie textures to play using only a .osg file as the input to osgviewer. From skulking around in the source code I figured out how "osgviewer --movie" plays movies on a polygon and took that idea and applied it to the texture handling source files in osgPlugins/osg.

I added the following code to Texture1D.cpp, Texture2D.cpp, Texture3D.cpp and TextureRectangle.cpp:

#include "osg/ImageStream"

....

if (fr[0].matchWord("movie") && fr[1].isString())
{
        std::string filename = fr[1].getStr();
        Image* image = fr.readImage(filename.c_str());
        ImageStream* imagestream = dynamic_cast<osg::ImageStream*>(image);
        if (imagestream) {
                texture.setImage(imagestream);
                imagestream->play();
        }
}

....

So far it's worked. Is this something that's going to work out in the long run? Is there a better way for me to do what I've done?
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to