summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2012-01-27 12:41:18 -0600
committerDave Parks <davep@lindenlab.com>2012-01-27 12:41:18 -0600
commite0a62d894145a6903727e95890bfab6a925a11b7 (patch)
treedf4d870736d101e90d4c5ca10d923177efcd39c1 /indra/llui
parent17b21fc197f162a4070083c436920c0640431568 (diff)
SH-2768 Put transparency checkerboard back in texture preview
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llui.cpp54
1 files changed, 32 insertions, 22 deletions
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 6b74c5a6be..a38d0a0b0b 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -972,43 +972,53 @@ void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor
// Draw gray and white checkerboard with black border
void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha)
{
- // Initialize the first time this is called.
- const S32 PIXELS = 32;
- static GLubyte checkerboard[PIXELS * PIXELS];
- static BOOL first = TRUE;
- if( first )
- {
- for( S32 i = 0; i < PIXELS; i++ )
+ if (!LLGLSLShader::sNoFixedFunction)
+ {
+ // Initialize the first time this is called.
+ const S32 PIXELS = 32;
+ static GLubyte checkerboard[PIXELS * PIXELS];
+ static BOOL first = TRUE;
+ if( first )
{
- for( S32 j = 0; j < PIXELS; j++ )
+ for( S32 i = 0; i < PIXELS; i++ )
{
- checkerboard[i * PIXELS + j] = ((i & 1) ^ (j & 1)) * 0xFF;
+ for( S32 j = 0; j < PIXELS; j++ )
+ {
+ checkerboard[i * PIXELS + j] = ((i & 1) ^ (j & 1)) * 0xFF;
+ }
}
+ first = FALSE;
}
- first = FALSE;
- }
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- // ...white squares
- gGL.color4f( 1.f, 1.f, 1.f, alpha );
- gl_rect_2d(rect);
+ // ...white squares
+ gGL.color4f( 1.f, 1.f, 1.f, alpha );
+ gl_rect_2d(rect);
- // ...gray squares
- gGL.color4f( .7f, .7f, .7f, alpha );
- gGL.flush();
+ // ...gray squares
+ gGL.color4f( .7f, .7f, .7f, alpha );
+ gGL.flush();
- if (!LLGLSLShader::sNoFixedFunction)
- { //polygon stipple is deprecated
glPolygonStipple( checkerboard );
LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE);
gl_rect_2d(rect);
}
else
- {
- gl_rect_2d(rect);
+ { //polygon stipple is deprecated, use "Checker" texture
+ LLPointer<LLUIImage> img = LLUI::getUIImage("Checker");
+ gGL.getTexUnit(0)->bind(img->getImage());
+ gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
+ gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
+
+ LLColor4 color(1.f, 1.f, 1.f, alpha);
+ LLRectf uv_rect(0, 0, rect.getWidth()/32.f, rect.getHeight()/32.f);
+
+ gl_draw_scaled_image(rect.mLeft, rect.mBottom, rect.getWidth(), rect.getHeight(),
+ img->getImage(), color, uv_rect);
}
+
gGL.flush();
}