diff options
author | Dave Parks <davep@lindenlab.com> | 2013-06-27 16:16:56 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2013-06-27 16:16:56 -0500 |
commit | 380785e613b9823cb6160be5678e5f01783fee5f (patch) | |
tree | dce0f35d02994c861428683b91f64371e9a64ea0 /indra/llrender/llrender.cpp | |
parent | 21b78d7368f969fdf0daf7994fb565da633b1e71 (diff) | |
parent | 4696eeeb30ce4d01c3bcbe74c9024f05d848968a (diff) |
Automated merge with https://bitbucket.org/lindenlab/viewer-development-materials
Diffstat (limited to 'indra/llrender/llrender.cpp')
-rwxr-xr-x | indra/llrender/llrender.cpp | 66 |
1 files changed, 51 insertions, 15 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index f2f1b62be0..b22ad60750 100755 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -225,26 +225,15 @@ void LLTexUnit::disable(void) bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind) { stop_glerror(); - if (mIndex < 0) return false; - + if (mIndex >= 0) + { gGL.flush(); LLImageGL* gl_tex = NULL ; - if (texture == NULL || !(gl_tex = texture->getGLTexture())) + if (texture != NULL && (gl_tex = texture->getGLTexture())) { - llwarns << "NULL LLTexUnit::bind texture" << llendl; - return false; - } - - if (!gl_tex->getTexName()) //if texture does not exist + if (gl_tex->getTexName()) //if texture exists { - //if deleted, will re-generate it immediately - texture->forceImmediateUpdate() ; - - gl_tex->forceUpdateBindStats() ; - return texture->bindDefaultImage(mIndex); - } - //in audit, replace the selected texture by the default one. if ((mCurrTexture != gl_tex->getTexName()) || forceBind) { @@ -265,6 +254,27 @@ bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind) setTextureFilteringOption(gl_tex->mFilterOption); } } + } + else + { + //if deleted, will re-generate it immediately + texture->forceImmediateUpdate() ; + + gl_tex->forceUpdateBindStats() ; + return texture->bindDefaultImage(mIndex); + } + } + else + { + llwarns << "NULL LLTexUnit::bind texture" << llendl; + return false; + } + } + else + { // mIndex < 0 + return false; + } + return true; } @@ -1058,6 +1068,16 @@ LLRender::~LLRender() void LLRender::init() { + if (sGLCoreProfile && !LLVertexBuffer::sUseVAO) + { //bind a dummy vertex array object so we're core profile compliant +#ifdef GL_ARB_vertex_array_object + U32 ret; + glGenVertexArrays(1, &ret); + glBindVertexArray(ret); +#endif + } + + llassert_always(mBuffer.isNull()) ; stop_glerror(); mBuffer = new LLVertexBuffer(immediate_mask, 0); @@ -2281,6 +2301,22 @@ void LLRender::diffuseColor4ubv(const U8* c) } } +void LLRender::diffuseColor4ub(U8 r, U8 g, U8 b, U8 a) +{ + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL); + + if (shader) + { + shader->uniform4f(LLShaderMgr::DIFFUSE_COLOR, r/255.f, g/255.f, b/255.f, a/255.f); + } + else + { + glColor4ub(r,g,b,a); + } +} + + void LLRender::debugTexUnits(void) { LL_INFOS("TextureUnit") << "Active TexUnit: " << mCurrTextureUnitIndex << LL_ENDL; |