本文整理汇总了C++中LLRender类的典型用法代码示例。如果您正苦于以下问题:C++ LLRender类的具体用法?C++ LLRender怎么用?C++ LLRender使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLRender类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: refreshState
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);
}
}
示例2: setColorScale
void LLTexUnit::setColorScale(S32 scale)
{
if (mCurrColorScale != scale || gGL.mDirty)
{
mCurrColorScale = scale;
gGL.flush();
glTexEnvi( GL_TEXTURE_ENV, GL_RGB_SCALE, scale );
}
}
示例3: setAlphaScale
void LLTexUnit::setAlphaScale(S32 scale)
{
if (mCurrAlphaScale != scale || gGL.mDirty)
{
mCurrAlphaScale = scale;
gGL.flush();
glTexEnvi( GL_TEXTURE_ENV, GL_ALPHA_SCALE, scale );
}
}
示例4: activate
void LLTexUnit::activate(void)
{
if (mIndex < 0) return;
if ((S32)gGL.mCurrTextureUnitIndex != mIndex || gGL.mDirty)
{
gGL.flush();
glActiveTextureARB(GL_TEXTURE0_ARB + mIndex);
gGL.mCurrTextureUnitIndex = mIndex;
}
}
示例5: bind
bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind)
{
stop_glerror();
if (mIndex < 0) return false;
gGL.flush();
if (texture == NULL)
{
llwarns << "NULL LLTexUnit::bind texture" << llendl;
return false;
}
if (!texture->getTexName()) //if texture does not exist
{
//if deleted, will re-generate it immediately
texture->forceImmediateUpdate() ;
return texture->bindDefaultImage(mIndex);
}
#if !LL_RELEASE_FOR_DOWNLOAD
if(for_rendering)
{
int w = texture->getWidth(texture->getDiscardLevel()) ;
int h = texture->getHeight(texture->getDiscardLevel()) ;
if(w * h == LLImageGL::sCurTexPickSize)
{
texture->updateBindStats();
return bind(LLImageGL::sDefaultTexturep.get());
}
}
#endif
if ((mCurrTexture != texture->getTexName()) || forceBind)
{
activate();
enable(texture->getTarget());
mCurrTexture = texture->getTexName();
glBindTexture(sGLTextureType[texture->getTarget()], mCurrTexture);
texture->updateBindStats();
texture->setActive() ;
mHasMipMaps = texture->mHasMipMaps;
if (texture->mTexOptionsDirty)
{
texture->mTexOptionsDirty = false;
setTextureAddressMode(texture->mAddressMode);
setTextureFilteringOption(texture->mFilterOption);
}
}
return true;
}
示例6: bind
bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind)
{
stop_glerror();
if (mIndex < 0) return false;
gGL.flush();
LLImageGL* gl_tex = NULL ;
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 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(gAuditTexture && for_rendering && LLImageGL::sCurTexPickSize > 0)
{
if(texture->getWidth() * texture->getHeight() == LLImageGL::sCurTexPickSize)
{
gl_tex->updateBindStats(gl_tex->mTextureMemory);
return bind(LLImageGL::sHighlightTexturep.get());
}
}
if ((mCurrTexture != gl_tex->getTexName()) || forceBind)
{
activate();
enable(gl_tex->getTarget());
mCurrTexture = gl_tex->getTexName();
glBindTexture(sGLTextureType[gl_tex->getTarget()], mCurrTexture);
if(gl_tex->updateBindStats(gl_tex->mTextureMemory))
{
texture->setActive() ;
texture->updateBindStatsForTester() ;
}
mHasMipMaps = gl_tex->mHasMipMaps;
if (gl_tex->mTexOptionsDirty)
{
gl_tex->mTexOptionsDirty = false;
setTextureAddressMode(gl_tex->mAddressMode);
setTextureFilteringOption(gl_tex->mFilterOption);
}
}
return true;
}
示例7: disable
void LLTexUnit::disable(void)
{
if (mIndex < 0) return;
if (mCurrTexType != TT_NONE)
{
activate();
unbind(mCurrTexType);
gGL.flush();
glDisable(sGLTextureType[mCurrTexType]);
mCurrTexType = TT_NONE;
}
}
示例8: setTextureAddressMode
void LLTexUnit::setTextureAddressMode(eTextureAddressMode mode)
{
if (mIndex < 0 || mCurrTexture == 0) return;
gGL.flush();
activate();
glTexParameteri (sGLTextureType[mCurrTexType], GL_TEXTURE_WRAP_S, sGLAddressMode[mode]);
glTexParameteri (sGLTextureType[mCurrTexType], GL_TEXTURE_WRAP_T, sGLAddressMode[mode]);
if (mCurrTexType == TT_CUBE_MAP)
{
glTexParameteri (GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_R, sGLAddressMode[mode]);
}
}
示例9: bindManual
bool LLTexUnit::bindManual(eTextureType type, U32 texture, bool hasMips)
{
if (mIndex < 0) return false;
if(mCurrTexture != texture)
{
gGL.flush();
activate();
enable(type);
mCurrTexture = texture;
glBindTexture(sGLTextureType[type], texture);
mHasMipMaps = hasMips;
}
return true;
}
示例10: unbind
void LLTexUnit::unbind(eTextureType type)
{
stop_glerror();
if (mIndex < 0) return;
// Disabled caching of binding state.
if (mCurrTexType == type)
{
gGL.flush();
activate();
mCurrTexture = 0;
glBindTexture(sGLTextureType[type], 0);
}
}
示例11: setTextureFilteringOption
void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions option)
{
if (mIndex < 0 || mCurrTexture == 0) return;
gGL.flush();
if (option == TFO_POINT)
{
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
else
{
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
if (option >= TFO_TRILINEAR && mHasMipMaps)
{
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
}
else if (option >= TFO_BILINEAR)
{
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}
else
{
glTexParameteri(sGLTextureType[mCurrTexType], GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
if (gGLManager.mHasAnisotropic)
{
if (LLImageGL::sGlobalUseAnisotropic && option == TFO_ANISOTROPIC)
{
if (gGL.mMaxAnisotropy < 1.f)
{
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gGL.mMaxAnisotropy);
llinfos << "gGL.mMaxAnisotropy: " << gGL.mMaxAnisotropy << llendl ;
gGL.mMaxAnisotropy = llmax(1.f, gGL.mMaxAnisotropy) ;
}
glTexParameterf(sGLTextureType[mCurrTexType], GL_TEXTURE_MAX_ANISOTROPY_EXT, gGL.mMaxAnisotropy);
}
else
{
glTexParameterf(sGLTextureType[mCurrTexType], GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.f);
}
}
}
示例12: enable
void LLTexUnit::enable(eTextureType type)
{
if (mIndex < 0) return;
if ( (mCurrTexType != type || gGL.mDirty) && (type != TT_NONE) )
{
activate();
if (mCurrTexType != TT_NONE && !gGL.mDirty)
{
disable(); // Force a disable of a previous texture type if it's enabled.
}
mCurrTexType = type;
gGL.flush();
glEnable(sGLTextureType[type]);
}
}
示例13: refreshState
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);
}
}
示例14: setTextureBlendType
void LLTexUnit::setTextureBlendType(eTextureBlendType type)
{
if (mIndex < 0) return;
// Do nothing if it's already correctly set.
if (mCurrBlendType == type && !gGL.mDirty)
{
return;
}
gGL.flush();
activate();
mCurrBlendType = type;
S32 scale_amount = 1;
switch (type)
{
case TB_REPLACE:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
break;
case TB_ADD:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD);
break;
case TB_MULT:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
break;
case TB_MULT_X2:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
scale_amount = 2;
break;
case TB_ALPHA_BLEND:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
break;
case TB_COMBINE:
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
break;
default:
llerrs << "Unknown Texture Blend Type: " << type << llendl;
break;
}
setColorScale(scale_amount);
setAlphaScale(1);
}
示例15: bind
bool LLTexUnit::bind(LLCubeMap* cubeMap)
{
if (mIndex < 0) return false;
gGL.flush();
if (cubeMap == NULL)
{
llwarns << "NULL LLTexUnit::bind cubemap" << llendl;
return false;
}
if (cubeMap->mImages[0].isNull())
{
llwarns << "NULL LLTexUnit::bind cubeMap->mImages[0]" << llendl;
return false;
}
if (mCurrTexture != cubeMap->mImages[0]->getTexName())
{
if (gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps)
{
activate();
enable(LLTexUnit::TT_CUBE_MAP);
mCurrTexture = cubeMap->mImages[0]->getTexName();
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mCurrTexture);
mHasMipMaps = cubeMap->mImages[0]->mHasMipMaps;
cubeMap->mImages[0]->updateBindStats(cubeMap->mImages[0]->mTextureMemory);
if (cubeMap->mImages[0]->mTexOptionsDirty)
{
cubeMap->mImages[0]->mTexOptionsDirty = false;
setTextureAddressMode(cubeMap->mImages[0]->mAddressMode);
setTextureFilteringOption(cubeMap->mImages[0]->mFilterOption);
}
return true;
}
else
{
llwarns << "Using cube map without extension!" << llendl;
return false;
}
}
return true;
}