diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index a2add954f..ee06d32b9 100644 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -373,7 +373,7 @@ void LLPostProcess::createScreenTexture() { gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, mSceneRenderTexture->getTexName()); LLImageGL::setManualImage(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGB, mScreenWidth, mScreenHeight, GL_RGB, GL_UNSIGNED_BYTE, &data[0]); - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); } } diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 346f26eff..7fd3015e5 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -949,45 +949,21 @@ 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) +void gl_rect_2d_checkerboard(const LLRect& parent_screen_rect, 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++ ) - { - for( S32 j = 0; j < PIXELS; j++ ) - { - checkerboard[i * PIXELS + j] = ((i & 1) ^ (j & 1)) * 0xFF; - } - } - first = FALSE; - } + //Already reffed in LLImageList via uuid_ui_image_map_t mUIImages. Don't use LLPointer here! + static LLUIImage* checkboard_image = LLUI::getUIImage("checkerboard.tga"); + static F32 image_width = checkboard_image->getWidth(); + static F32 image_height = checkboard_image->getHeight(); + + F32 scale_x = rect.getWidth() / image_width; + F32 scale_y = rect.getHeight() / image_height; + F32 offs_x = (parent_screen_rect.mLeft + rect.mLeft) / image_width; + F32 offs_y = (parent_screen_rect.mBottom + rect.mBottom) / image_height; + LLRectf uv_rect(offs_x,offs_y+scale_y,offs_x+scale_x,offs_y); + + gl_draw_scaled_image(rect.mLeft,rect.mBottom,rect.getWidth(),rect.getHeight(),checkboard_image->getImage(), UI_VERTEX_COLOR, uv_rect); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - // ...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(); - - if (!LLGLSLShader::sNoFixedFunction) - { //polygon stipple is deprecated - glPolygonStipple( checkerboard ); - - LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE); - gl_rect_2d(rect); - } - else - { - gl_rect_2d(rect); - } gGL.flush(); } diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 81dd94863..3c31ed27b 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -78,7 +78,7 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LL void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset = 0, BOOL filled = TRUE ); void gl_rect_2d(const LLRect& rect, BOOL filled = TRUE ); void gl_rect_2d(const LLRect& rect, const LLColor4& color, BOOL filled = TRUE ); -void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha = 1.0f); +void gl_rect_2d_checkerboard(const LLRect& parent_screen_rect, const LLRect& rect, GLfloat alpha = 1.0f); void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &start_color, S32 lines); diff --git a/indra/newview/floatersculptpreview.cpp b/indra/newview/floatersculptpreview.cpp index 8963abfa8..09356154d 100644 --- a/indra/newview/floatersculptpreview.cpp +++ b/indra/newview/floatersculptpreview.cpp @@ -259,7 +259,7 @@ void LLFloaterSculptPreview::draw() if (selected <= 0) { - gl_rect_2d_checkerboard(mPreviewRect); + gl_rect_2d_checkerboard(getScreenRect(),mPreviewRect); LLGLDisable gls_alpha(GL_ALPHA_TEST); if(mImagep.notNull()) diff --git a/indra/newview/llcolorswatch.cpp b/indra/newview/llcolorswatch.cpp index 4504fb986..2ba89a29a 100644 --- a/indra/newview/llcolorswatch.cpp +++ b/indra/newview/llcolorswatch.cpp @@ -218,7 +218,7 @@ void LLColorSwatchCtrl::draw() if ( mValid ) { // Draw the color swatch - gl_rect_2d_checkerboard( interior ); + gl_rect_2d_checkerboard( getScreenRect(), interior ); gl_rect_2d(interior, mColor, TRUE); LLColor4 opaque_color = mColor; opaque_color.mV[VALPHA] = 1.f; @@ -239,7 +239,7 @@ void LLColorSwatchCtrl::draw() LLPointer fallback_image = LLViewerTextureManager::getFetchedTextureFromFile(mFallbackImageName); if( fallback_image->getComponents() == 4 ) { - gl_rect_2d_checkerboard( interior ); + gl_rect_2d_checkerboard( getScreenRect(), interior ); } gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), fallback_image); fallback_image->addTextureStats( (F32)(interior.getWidth() * interior.getHeight()) ); diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 36409e765..67c20c91d 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -264,7 +264,7 @@ void LLFloaterImagePreview::draw() if (selected <= 0) { - gl_rect_2d_checkerboard(mPreviewRect); + gl_rect_2d_checkerboard( getScreenRect(), mPreviewRect); LLGLDisable gls_alpha(GL_ALPHA_TEST); if(mImagep.notNull()) diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index fd57ff602..338aa899e 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -270,7 +270,7 @@ void LLPreviewTexture::draw() // ...border gl_rect_2d( border, LLColor4(0.f, 0.f, 0.f, 1.f)); - gl_rect_2d_checkerboard( interior ); + gl_rect_2d_checkerboard( getScreenRect(), interior ); if ( mImage.notNull() ) { diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 89eca8e42..854d67841 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -648,7 +648,7 @@ void LLFloaterTexturePicker::draw() { if( mTexturep->getComponents() == 4 ) { - gl_rect_2d_checkerboard( interior ); + gl_rect_2d_checkerboard( getScreenRect(), interior ); } gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep ); @@ -1540,7 +1540,7 @@ void LLTextureCtrl::draw() { if( mTexturep->getComponents() == 4 ) { - gl_rect_2d_checkerboard( interior ); + gl_rect_2d_checkerboard( getScreenRect(), interior ); } gl_draw_scaled_image( interior.mLeft, interior.mBottom, interior.getWidth(), interior.getHeight(), mTexturep); diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 4d8f0c83b..f3a0c6bb8 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -166,6 +166,16 @@ void LLViewerTextureList::doPreloadImages() image->setAddressMode(LLTexUnit::TAM_WRAP); mImagePreloads.insert(image); } + //Hideous hack to set filtering and address modes without messing with our texture classes. + { + LLPointer temp_image = image_list->getUIImage("checkerboard.tga",LLViewerFetchedTexture::BOOST_UI); + if(temp_image.notNull() && temp_image->getImage().notNull()) + { + LLViewerTexture *tex = (LLViewerTexture*)temp_image->getImage().get(); + tex->setAddressMode(LLTexUnit::TAM_WRAP); + tex->setFilteringOption(LLTexUnit::TFO_POINT); + } + } } diff --git a/indra/newview/skins/default/textures/checkerboard.tga b/indra/newview/skins/default/textures/checkerboard.tga new file mode 100644 index 000000000..8ee0be57c Binary files /dev/null and b/indra/newview/skins/default/textures/checkerboard.tga differ