Added osg::Image::dirtyImage() and setModifiedTag() to allow external

updating of the image modified flag to be used in conjunction with
texture subloading.
This commit is contained in:
Robert Osfield 2001-11-18 21:31:16 +00:00
parent 3ff4fb6b50
commit 969f757679
2 changed files with 13 additions and 1 deletions

View File

@ -69,7 +69,13 @@ class SG_EXPORT Image : public Object
*/ */
void ensureDimensionsArePowerOfTwo(); void ensureDimensionsArePowerOfTwo();
/** Get modified tag value. */ /** Dirty the image, which increments the modified flag, to force osg::Texture to reload the image.*/
inline void dirtyImage() { ++_modifiedTag; }
/** Set the modified tag value, only used by osg::Texture when using texture subloading. */
inline void setModifiedTag(const unsigned int value) { _modifiedTag=value; }
/** Get modified tag value, only used by osg::Texture when using texture subloading. */
inline const unsigned int getModifiedTag() const { return _modifiedTag; } inline const unsigned int getModifiedTag() const { return _modifiedTag; }
protected : protected :

View File

@ -22,6 +22,8 @@ Image::Image()
_packing = 4; _packing = 4;
_data = (unsigned char *)0L; _data = (unsigned char *)0L;
_modifiedTag = 0;
} }
@ -69,6 +71,8 @@ void Image::setImage(const int s,const int t,const int r,
// test scaling... // test scaling...
// scaleImageTo(16,16,_r); // scaleImageTo(16,16,_r);
++_modifiedTag;
} }
void Image::scaleImage(const int s,const int t,const int /*r*/) void Image::scaleImage(const int s,const int t,const int /*r*/)
@ -106,6 +110,8 @@ void Image::scaleImage(const int s,const int t,const int /*r*/)
notify(WARN) << "Error Image::scaleImage() do not succeed : errorString = "<<gluErrorString((GLenum)status)<<endl; notify(WARN) << "Error Image::scaleImage() do not succeed : errorString = "<<gluErrorString((GLenum)status)<<endl;
} }
++_modifiedTag;
} }