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
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to