Re: [osg-users] Adding code for movie textures

2008-09-19 Thread Robert Osfield
Hi Patrick,

Playing movies automatically isn't that what all users will want all
the time, so hard coding this in isn't appropriate.  In the past I've
always just used a custom NodeVisitor to traverse through an enable
the movies, this is pretty straight forward to write and retains
complete control to the application developer. You could place such a
visitor inside a osgDB::Registry::ReadFileCallback to apply the
visitor automatically to all loaded models.

Robert.

On Fri, Sep 19, 2008 at 12:53 AM, Patrick A. Webb <[EMAIL PROTECTED]> wrote:
> 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(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
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Adding code for movie textures

2008-09-18 Thread Patrick A. Webb
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(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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org