03.12.2010 17:22, Robert Osfield wrote:
Hi Thomas,

I'm not sure of what form this method needs to take yet.. will do some
further thinking on the topic.
I have settled upon a new SubloadCallback method:

         class OSG_EXPORT SubloadCallback : public Referenced
         {
             public:

                 virtual bool textureObjectValid(const Texture2D&
texture, State&  state) const
                 {
                     return texture.textureObjectValid(state);
                 }

                ...

         };

And a new Texture2D helper method,
Texture2D::textureObjectValid(State&) that can be used by the
SubloadCallback as above with the default implementation, or by
osg::Texture2D::apply() itself to tell whether any modifications to
the Texture2D's Image will mean that the TextureObject needs
discarding and a new one to be created.
Your latest changes caused very often call of computeInternalFormat, computeRequiredTextureDimensions and textureObject->match methods. In previous code this methods called only when getModifiedCount(contextID) != _image->getModifiedCount().

Maybe would be better something like that:
Index: src/osg/Texture2D.cpp
===================================================================
--- src/osg/Texture2D.cpp       (revision 11982)
+++ src/osg/Texture2D.cpp       (working copy)
@@ -160,7 +160,7 @@

     // get the texture object for the current contextID.
     TextureObject* textureObject = getTextureObject(contextID);
-    if (textureObject && !textureObjectValid(state))
+    if (textureObject)
     {
         bool textureObjectInvalidated = false;
         if (_subloadCallback.valid())


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

Reply via email to