diff options
Diffstat (limited to 'lib/gltexture.cc')
-rw-r--r-- | lib/gltexture.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/gltexture.cc b/lib/gltexture.cc index b96184f..2758c05 100644 --- a/lib/gltexture.cc +++ b/lib/gltexture.cc @@ -10,7 +10,7 @@ mogltk::texture * mogltk::texture::footer = 0; #endif mogltk::texture::texture(int w, int h, bool plane) throw (GeneralException) : width(w), height(h), - texture_allocated(false), planar(plane) { + texture_allocated(false), planar(plane), tainted(true) { if ((BITCOUNT(w) != 1) || (BITCOUNT(h) != 1)) throw GeneralException("Size of the texture not a power of 2!"); @@ -96,10 +96,11 @@ void mogltk::texture::Generate() { } texture_allocated = true; + tainted = false; } void mogltk::texture::Bind(bool expand) { - if (!texture_allocated) + if ((!texture_allocated) || tainted) Generate(); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, tex); @@ -142,3 +143,7 @@ GLuint mogltk::texture::GetHeight() { void mogltk::texture::Unbind(void) { glDisable(GL_TEXTURE_2D); } + +void mogltk::texture::Taint(void) { + tainted = true; +} |