Hi all! In my OSG application I need to continuously update small parts of 2D texture. So I use osg::Texture2D::SubloadCallback:
class MyCallback : public osg::Texture2D::SubloadCallback { /* initialize texture */ void load(const Texture2D& texture,State& state) const { /* get pixel buffer object extension functions */ osg::PixelBufferObject::Extensions* ext = osg::PixelBufferObject::getExtensions(state.getContextID(), true); /* generate and cache PBO ID */ ext->glGenBuffers(1, &m_pbo); if(m_pbo) { /* bind buffer */ ext->glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, m_pbo); /* load texture initial data */ /* unbind buffer */ ext->glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0); } } void subload(const osg::Texture2D& tex, osg::State& state) const { /* bind buffer */ ext->glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, m_pbo); /* update some small part of the texture */ /* unbind buffer */ ext->glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0); } private: GLuint m_pbo; }; And everything works fine until the cleanup stage. In the code above I've allocated a Pixel Buffer Object. Where should I place it's deletion function (something like ext->glDeleteBuffers(1, &m_pbo))? Or I should generate/delete it on every subload call with performance penalty? _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org