From 6c0d321e3dbadc95e4af620602d5e4c38c1ea567 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 8 Dec 2009 16:02:43 +0000 Subject: [PATCH] From Fabien Lavignotte, "i have a problem with my application, i am currently playing with Texture2D::SubloadCallback to optimize my image data transfer, and also avoid double buffering when using a drawing thread. There is a small bug with your change and SubloadCallback, the texture object is destroy at each call of Texture2D::apply because the modified count is never updated when using SubloadCallback. I have made a small fix to avoid that, see attachement." From Robert Osfield, added an if (_image.valid()) before the getModified() that Fabien added to avoid problems when no _image is assigned but an subload callback is. --- src/osg/Texture2D.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/osg/Texture2D.cpp b/src/osg/Texture2D.cpp index 5680708b3..62daae9e8 100644 --- a/src/osg/Texture2D.cpp +++ b/src/osg/Texture2D.cpp @@ -210,6 +210,8 @@ void Texture2D::apply(State& state) const // perhaps it is the first glBind which is not required... //glBindTexture( GL_TEXTURE_2D, handle ); + // update the modified tag to show that it is upto date. + if (_image.vaid()) getModifiedCount(contextID) = _image->getModifiedCount(); } else if (_image.valid() && _image->data()) {