void LLTexUnit::refreshState(void) { // We set dirty to true so that the tex unit knows to ignore caching // and we reset the cached tex unit state gGL.flush(); glActiveTextureARB(GL_TEXTURE0_ARB + mIndex); if (mCurrTexType != TT_NONE) { glEnable(sGLTextureType[mCurrTexType]); glBindTexture(sGLTextureType[mCurrTexType], mCurrTexture); } else { glDisable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, 0); } if (mCurrBlendType != TB_COMBINE) { setTextureBlendType(mCurrBlendType); } else { setTextureCombiner(mCurrColorOp, mCurrColorSrc1, mCurrColorSrc2, false); setTextureCombiner(mCurrAlphaOp, mCurrAlphaSrc1, mCurrAlphaSrc2, true); } }
void LLTexUnit::refreshState(void) { // We set dirty to true so that the tex unit knows to ignore caching // and we reset the cached tex unit state gGL.flush(); glActiveTextureARB(GL_TEXTURE0_ARB + mIndex); // // Per apple spec, don't call glEnable/glDisable when index exceeds max texture units // http://www.mailinglistarchive.com/html/[email protected]/2008-07/msg00653.html // bool enableDisable = (mIndex < gGLManager.mNumTextureUnits); if (mCurrTexType != TT_NONE) { if (enableDisable) { glEnable(sGLTextureType[mCurrTexType]); } glBindTexture(sGLTextureType[mCurrTexType], mCurrTexture); } else { if (enableDisable) { glDisable(GL_TEXTURE_2D); } glBindTexture(GL_TEXTURE_2D, 0); } if (mCurrBlendType != TB_COMBINE) { setTextureBlendType(mCurrBlendType); } else { setTextureCombiner(mCurrColorOp, mCurrColorSrc1, mCurrColorSrc2, false); setTextureCombiner(mCurrAlphaOp, mCurrAlphaSrc1, mCurrAlphaSrc2, true); } }