diff --git a/BBGE/RenderObject.cpp b/BBGE/RenderObject.cpp index 672f428..88e2b7e 100644 --- a/BBGE/RenderObject.cpp +++ b/BBGE/RenderObject.cpp @@ -33,7 +33,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. bool RenderObject::renderCollisionShape = false; size_t RenderObject::lastTextureApplied = 0; -bool RenderObject::lastTextureRepeat = false; bool RenderObject::renderPaths = false; void RenderObject::toggleAlpha(float t) @@ -482,20 +481,18 @@ nofollow: { if (texture) { - if (texture->gltexid != lastTextureApplied || repeatTexture != lastTextureRepeat) + if (texture->gltexid != lastTextureApplied) { - texture->apply(repeatTexture); - lastTextureRepeat = repeatTexture; + texture->apply(); lastTextureApplied = texture->gltexid; } } else { - if (lastTextureApplied != 0 || repeatTexture != lastTextureRepeat) + if (lastTextureApplied != 0) { glBindTexture(GL_TEXTURE_2D, 0); lastTextureApplied = 0; - lastTextureRepeat = repeatTexture; } } diff --git a/BBGE/RenderObject.h b/BBGE/RenderObject.h index 83a18b0..9d02791 100644 --- a/BBGE/RenderObject.h +++ b/BBGE/RenderObject.h @@ -223,7 +223,6 @@ public: static bool renderCollisionShape; static bool renderPaths; static size_t lastTextureApplied; - static bool lastTextureRepeat; //-------------------------- diff --git a/BBGE/Texture.cpp b/BBGE/Texture.cpp index 746c61f..b7fd003 100644 --- a/BBGE/Texture.cpp +++ b/BBGE/Texture.cpp @@ -49,7 +49,6 @@ Texture::Texture() gltexid = 0; width = height = 0; - _repeating = false; ow = oh = -1; _mipmap = false; success = false; @@ -98,16 +97,9 @@ void Texture::unload() } static const GLenum repeatLUT[] = { GL_CLAMP_TO_EDGE, GL_REPEAT }; -void Texture::apply(bool repeat) const +void Texture::apply() const { glBindTexture(GL_TEXTURE_2D, gltexid); - /*if(repeat != _repeating) - { - _repeating = repeat; - GLenum rep = repeatLUT[repeat]; - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, rep); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, rep); - }*/ } struct GlTexFormat @@ -142,7 +134,6 @@ bool Texture::upload(const ImageData& img, bool mipmap) glBindTexture(GL_TEXTURE_2D, gltexid); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T, GL_REPEAT); - _repeating = false; const GlTexFormat& f = formatLUT[img.channels - 1]; diff --git a/BBGE/Texture.h b/BBGE/Texture.h index 37391ed..6469af0 100644 --- a/BBGE/Texture.h +++ b/BBGE/Texture.h @@ -47,7 +47,7 @@ public: Texture(); ~Texture(); - void apply(bool repeat = false) const; + void apply() const; void unload(); unsigned gltexid; @@ -67,8 +67,6 @@ protected: int ow, oh; bool _mipmap; -private: - mutable bool _repeating; // modified during rendering }; #define UNREFTEX(x) {x = NULL;} diff --git a/BBGE/TileRender.cpp b/BBGE/TileRender.cpp index e189442..8c18265 100644 --- a/BBGE/TileRender.cpp +++ b/BBGE/TileRender.cpp @@ -59,7 +59,6 @@ void TileRender::onRender(const RenderState& rs) const const Vector M1 = Vector(1,1) - M; const Vector T = C * (1 - F); - unsigned lastTexRepeat = false; unsigned lastTexId = 0; const bool renderExtras = renderBorders || RenderObject::renderCollisionShape; @@ -92,12 +91,10 @@ void TileRender::onRender(const RenderState& rs) const if(const Texture * const tex = et->tex.content()) { unsigned texid = tex->gltexid; - unsigned rep = tile.flags & TILEFLAG_REPEAT; - if(texid != lastTexId || rep != lastTexRepeat) + if(texid != lastTexId) { lastTexId = texid; - lastTexRepeat = rep; - tex->apply(!!rep); + tex->apply(); } } else @@ -210,7 +207,6 @@ void TileRender::onRender(const RenderState& rs) const glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); RenderObject::lastTextureApplied = lastTexId; - RenderObject::lastTextureRepeat = !!lastTexRepeat; } void TileRender::onUpdate(float dt)