Introduced bool Texture2D::textureObjectValid(State) and bool SubloadCallback::textureObjectValid(Texture2D&,State&) method to make it tell Texture2D::apply() whether the texture object is still valid or whether it's no longed valid for the any changes to the image attached to the Texture

This commit is contained in:
Robert Osfield
2010-12-03 14:18:16 +00:00
parent 0754a78ddb
commit 06509b9769
2 changed files with 46 additions and 16 deletions

View File

@@ -87,6 +87,12 @@ class OSG_EXPORT Texture2D : public Texture
class OSG_EXPORT SubloadCallback : public Referenced
{
public:
virtual bool textureObjectValid(const Texture2D& texture, State& state) const
{
return texture.textureObjectValid(state);
}
virtual TextureObject* generateTextureObject(const Texture2D& texture, State& state) const
{
return osg::Texture::generateTextureObject(&texture, state.getContextID(), GL_TEXTURE_2D);
@@ -132,6 +138,8 @@ class OSG_EXPORT Texture2D : public Texture
* compiled, create the texture mipmap levels. */
virtual void apply(State& state) const;
protected :
virtual ~Texture2D();
@@ -139,6 +147,10 @@ class OSG_EXPORT Texture2D : public Texture
virtual void computeInternalFormat() const;
void allocateMipmap(State& state) const;
/** Return true of the TextureObject assigned to the context associate with osg::State object is valid.*/
bool textureObjectValid(State& state) const;
friend class SubloadCallback;
ref_ptr<Image> _image;