Added set/getUnrefImageOnApply() methods and associated flag and

code in Texture::apply() to set the _image to 0 on apply.  Note,
this will only work when you have a single graphics context, as
with multiple graphics contexts one can't delete the image after
the first apply, as there will be more than one texture object to
update.
This commit is contained in:
Robert Osfield
2002-07-28 21:25:32 +00:00
parent 63e3364cc3
commit 05472135b0
2 changed files with 12 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ Texture::DeletedTextureObjectCache Texture::s_deletedTextureObjectCache;
Texture::Texture():
_target(GL_TEXTURE_2D),
_unrefImageAfterApply(true),
_wrap_s(CLAMP),
_wrap_t(CLAMP),
_wrap_r(CLAMP),
@@ -223,6 +224,9 @@ void Texture::apply(State& state) const
// unless a second bind is called?!!
// perhaps it is the first glBind which is not required...
glBindTexture( _target, handle );
if (_unrefImageAfterApply)
_image = 0;
}
}