summaryrefslogtreecommitdiff
path: root/indra/llrender/llrender.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llrender/llrender.cpp')
-rw-r--r--indra/llrender/llrender.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 969bfe608e..76762a1967 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -175,7 +175,7 @@ void LLTexUnit::disable(void)
}
}
-bool LLTexUnit::bind(const LLImageGL* texture)
+bool LLTexUnit::bind(const LLImageGL* texture, bool forceBind)
{
if (mIndex < 0) return false;
@@ -183,25 +183,27 @@ bool LLTexUnit::bind(const LLImageGL* texture)
if (texture == NULL)
{
- return texture->bindError(mIndex);
+ llwarns << "NULL LLTexUnit::bind texture" << llendl;
+ return false;
}
- if (!texture->isInitialized())
+ if (!texture->isInitialized() && !forceBind)
{
return texture->bindDefaultImage(mIndex);
}
- // Disabled caching of binding state.
- if (texture != NULL)
+ if (!texture->getTexName()) //if texture does not exist
{
- activate();
- enable(texture->getTarget());
- mCurrTexture = texture->getTexName();
- glBindTexture(sGLTextureType[texture->getTarget()], mCurrTexture);
- texture->updateBindStats();
- return true;
+ return texture->bindDefaultImage(mIndex);
}
- return false;
+
+ // Disabled caching of binding state.
+ activate();
+ enable(texture->getTarget());
+ mCurrTexture = texture->getTexName();
+ glBindTexture(sGLTextureType[texture->getTarget()], mCurrTexture);
+ texture->updateBindStats();
+ return true;
}
bool LLTexUnit::bind(LLCubeMap* cubeMap)