summaryrefslogtreecommitdiff
path: root/indra/llappearance
diff options
context:
space:
mode:
authorNyx (Neal Orman) <nyx@lindenlab.com>2012-10-18 15:00:05 -0400
committerNyx (Neal Orman) <nyx@lindenlab.com>2012-10-18 15:00:05 -0400
commitb9714ba85ebabdc39191565a26d732a82fd9a4a0 (patch)
tree33fb9a7245443fe0b575b37a34714de06883a462 /indra/llappearance
parent08f58ac3fdc89209b7bfbdf009803e75815505f4 (diff)
Setting alpha rejection settings properly for texture bakes without basic shaders enabled
Diffstat (limited to 'indra/llappearance')
-rw-r--r--indra/llappearance/lltexlayer.cpp90
1 files changed, 86 insertions, 4 deletions
diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp
index 6e2623b860..b8c8228f85 100644
--- a/indra/llappearance/lltexlayer.cpp
+++ b/indra/llappearance/lltexlayer.cpp
@@ -153,6 +153,10 @@ BOOL LLTexLayerSetBuffer::renderTexLayerSet()
gAlphaMaskProgram.bind();
gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
+ else
+ {
+ glAlphaFunc(GL_GEQUAL, 0.004f);
+ }
LLVertexBuffer::unbind();
@@ -400,6 +404,11 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
{
gAlphaMaskProgram.setMinimumAlpha(0.0f);
}
+ else
+ {
+ glAlphaFunc(GL_GEQUAL, 0.0f);
+ }
+
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.color4f( 0.f, 0.f, 0.f, 1.f );
@@ -410,6 +419,10 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
{
gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
+ else
+ {
+ glAlphaFunc(GL_GEQUAL, 0.004f);
+ }
}
if (mIsVisible)
@@ -440,6 +453,10 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
{
gAlphaMaskProgram.setMinimumAlpha(0.f);
}
+ else
+ {
+ glAlphaFunc(GL_GEQUAL, 0.0f);
+ }
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.color4f( 0.f, 0.f, 0.f, 0.f );
@@ -452,6 +469,11 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
{
gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
+ else
+ {
+ glAlphaFunc(GL_GEQUAL, 0.004f);
+ }
+
}
return success;
@@ -568,6 +590,11 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height,
{
gAlphaMaskProgram.setMinimumAlpha(0.f);
}
+ else
+ {
+ glAlphaFunc(GL_GEQUAL, 0.0f);
+ }
+
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.color4f( 0.f, 0.f, 0.f, 1.f );
@@ -578,6 +605,11 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height,
{
gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
+ else
+ {
+ glAlphaFunc(GL_GEQUAL, 0.004f);
+ }
+
}
// (Optional) Mask out part of the baked texture with alpha masks
@@ -1171,9 +1203,16 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height)
{
bool no_alpha_test = getInfo()->mWriteAllChannels;
LLGLDisable alpha_test(no_alpha_test ? GL_ALPHA_TEST : 0);
- if (use_shaders && no_alpha_test)
+ if (no_alpha_test)
{
- gAlphaMaskProgram.setMinimumAlpha(0.f);
+ if (use_shaders)
+ {
+ gAlphaMaskProgram.setMinimumAlpha(0.f);
+ }
+ else
+ {
+ glAlphaFunc(GL_GEQUAL, 0.0f);
+ }
}
LLTexUnit::eTextureAddressMode old_mode = tex->getAddressMode();
@@ -1185,9 +1224,16 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height)
gGL.getTexUnit(0)->setTextureAddressMode(old_mode);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- if (use_shaders && no_alpha_test)
+ if (no_alpha_test)
{
- gAlphaMaskProgram.setMinimumAlpha(0.004f);
+ if (use_shaders)
+ {
+ gAlphaMaskProgram.setMinimumAlpha(0.004f);
+ }
+ else
+ {
+ glAlphaFunc(GL_GEQUAL, 0.004f);
+ }
}
}
@@ -1226,6 +1272,11 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height)
{
gAlphaMaskProgram.setMinimumAlpha(0.f);
}
+ else
+ {
+ glAlphaFunc(GL_GEQUAL, 0.0f);
+ }
+
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.color4fv( net_color.mV );
gl_rect_2d_simple( width, height );
@@ -1233,6 +1284,10 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height)
{
gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
+ else
+ {
+ glAlphaFunc(GL_GEQUAL, 0.004f);
+ }
}
if( alpha_mask_specified || getInfo()->mWriteAllChannels )
@@ -1332,6 +1387,11 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height)
{
gAlphaMaskProgram.setMinimumAlpha(0.f);
}
+ else
+ {
+ glAlphaFunc(GL_GEQUAL, 0.0f);
+ }
+
gGL.getTexUnit(0)->bind(tex, TRUE);
gl_rect_2d_simple_tex( width, height );
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -1339,6 +1399,10 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height)
{
gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
+ else
+ {
+ glAlphaFunc(GL_GEQUAL, 0.004f);
+ }
}
else
{
@@ -1357,6 +1421,11 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height)
{
gAlphaMaskProgram.setMinimumAlpha(0.f);
}
+ else
+ {
+ glAlphaFunc(GL_GEQUAL, 0.0f);
+ }
+
gGL.getTexUnit(0)->bind(tex);
gl_rect_2d_simple_tex( width, height );
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -1365,6 +1434,10 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height)
{
gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
+ else
+ {
+ glAlphaFunc(GL_GEQUAL, 0.004f);
+ }
}
}
}
@@ -1391,6 +1464,11 @@ BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
{
gAlphaMaskProgram.setMinimumAlpha(0.f);
}
+ else
+ {
+ glAlphaFunc(GL_GEQUAL, 0.0f);
+ }
+
gGL.setColorMask(false, true);
@@ -1471,6 +1549,10 @@ BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
{
gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
+ else
+ {
+ glAlphaFunc(GL_GEQUAL, 0.004f);
+ }
LLGLSUIDefault gls_ui;