| All, I have currently setup an osg::Image use the buffer of a QImage. Every time I use a QPainter to update the QImage I call osg::Image::dirty() which causes OSG to update the texture. QImage qimage = QImage( width, height, QImage::Format_ARGB32_Premultiplied ); osg::ref_ptr image = new osg::Image(); image->setImage( width, height, 1, GL_RGBA, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, qimage.bits(), osg::Image::NO_DELETE ); image->setPixelBufferObject( new osg::PixelBufferObject(image.get()); image->setDataVariance( osg::Object::DYNAMIC ) image->setPixelFormat( GL_RGBA ); osg::ref_ptr texture; texture = new osg::TextureRectangle(image.get()); texture->setDataVariance( osg::Object::DYNAMIC ); QPainter p(&qimage); p.fillRect( QRect(x,y,w,h), Qt::red ); p.end(); image->dirty(); I would like to optimize this so that OSG doesn't have to subload the entire image, but only the part that changed. Perhaps we could extend the osg::Image API to have the following method? image->dirty( float x, float y, float w, float h ); Internally osg::Image could maintain a union of all of the dirty rects and then update only the part that needs it. Looking through the OSG code I see that there is already support for a "subload" callback. I would rather not have to implement that and I think that the API I suggested above would be what most people would implement in a subload callback anyway. What are your thoughts? Dan |
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
