On Sun, Dec 26, 2010 at 6:42 PM, Vicent Marti <[email protected]> wrote:

> Hello fine gentlemen,
>
> I'm trying to render a dynamic texture, whose pixels are manually
> modified during runtime. I'm assigning the texture like this:
>
>   osg::Texture2D* texture = new osg::Texture2D(img);
>   texture->setDataVariance(osg::Object::DYNAMIC);
>
>   osg::StateSet* state = geom->getOrCreateStateSet();
>   state->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
>
> where 'geom' is my geometry object, and 'img' is an osg::Image I've
> allocated manually, and which I plan to modify during runtime. The
> problem I'm having is that my 'geom' object is using the initial Image
> (the image as it was when assigning the TextureAttribute). Even if I
> modify the pixels in the Image, using img->data(), the rendered
> texture is not updated.
>
> What am I doing wrong? Is there a more optimal way to manually access
> the pixels of the rendered texture at runtime?
>
> Cheers,
> Vicent Marti
>
>
Hi Vincent,

Make sure to call img->dirty() after modifying the pixels in the image, in
order to update the texture with the new data.

Mourad
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to