aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lltexlayer.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/lltexlayer.cpp
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/newview/lltexlayer.cpp')
-rw-r--r--linden/indra/newview/lltexlayer.cpp60
1 files changed, 37 insertions, 23 deletions
diff --git a/linden/indra/newview/lltexlayer.cpp b/linden/indra/newview/lltexlayer.cpp
index 8958516..78fb126 100644
--- a/linden/indra/newview/lltexlayer.cpp
+++ b/linden/indra/newview/lltexlayer.cpp
@@ -52,6 +52,7 @@
52#include "llxmltree.h" 52#include "llxmltree.h"
53#include "pipeline.h" 53#include "pipeline.h"
54#include "v4coloru.h" 54#include "v4coloru.h"
55#include "llglimmediate.h"
55 56
56//#include "../tools/imdebug/imdebug.h" 57//#include "../tools/imdebug/imdebug.h"
57 58
@@ -176,22 +177,22 @@ void LLTexLayerSetBuffer::cancelUpload()
176void LLTexLayerSetBuffer::pushProjection() 177void LLTexLayerSetBuffer::pushProjection()
177{ 178{
178 glMatrixMode(GL_PROJECTION); 179 glMatrixMode(GL_PROJECTION);
179 glPushMatrix(); 180 gGL.pushMatrix();
180 glLoadIdentity(); 181 glLoadIdentity();
181 glOrtho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f); 182 glOrtho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f);
182 183
183 glMatrixMode(GL_MODELVIEW); 184 glMatrixMode(GL_MODELVIEW);
184 glPushMatrix(); 185 gGL.pushMatrix();
185 glLoadIdentity(); 186 glLoadIdentity();
186} 187}
187 188
188void LLTexLayerSetBuffer::popProjection() 189void LLTexLayerSetBuffer::popProjection()
189{ 190{
190 glMatrixMode(GL_PROJECTION); 191 glMatrixMode(GL_PROJECTION);
191 glPopMatrix(); 192 gGL.popMatrix();
192 193
193 glMatrixMode(GL_MODELVIEW); 194 glMatrixMode(GL_MODELVIEW);
194 glPopMatrix(); 195 gGL.popMatrix();
195} 196}
196 197
197BOOL LLTexLayerSetBuffer::needsRender() 198BOOL LLTexLayerSetBuffer::needsRender()
@@ -274,6 +275,7 @@ BOOL LLTexLayerSetBuffer::render()
274 // Composite the color data 275 // Composite the color data
275 LLGLSUIDefault gls_ui; 276 LLGLSUIDefault gls_ui;
276 success &= mTexLayerSet->render( mOrigin.mX, mOrigin.mY, mWidth, mHeight ); 277 success &= mTexLayerSet->render( mOrigin.mX, mOrigin.mY, mWidth, mHeight );
278 gGL.flush();
277 279
278 if( upload_now ) 280 if( upload_now )
279 { 281 {
@@ -291,7 +293,7 @@ BOOL LLTexLayerSetBuffer::render()
291 293
292 // reset GL state 294 // reset GL state
293 glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); 295 glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
294 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); 296 gGL.blendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
295 297
296 // we have valid texture data now 298 // we have valid texture data now
297 mInitialized = TRUE; 299 mInitialized = TRUE;
@@ -761,7 +763,9 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
761 LLTexLayer* layer = *iter; 763 LLTexLayer* layer = *iter;
762 if( layer->getRenderPass() == RP_COLOR ) 764 if( layer->getRenderPass() == RP_COLOR )
763 { 765 {
766 gGL.flush();
764 success &= layer->render( x, y, width, height ); 767 success &= layer->render( x, y, width, height );
768 gGL.flush();
765 } 769 }
766 } 770 }
767 771
@@ -769,8 +773,9 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
769 if( !getInfo()->mStaticAlphaFileName.empty() ) 773 if( !getInfo()->mStaticAlphaFileName.empty() )
770 { 774 {
771 LLGLSNoAlphaTest gls_no_alpha_test; 775 LLGLSNoAlphaTest gls_no_alpha_test;
776 gGL.flush();
772 glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE ); 777 glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE );
773 glBlendFunc( GL_ONE, GL_ZERO ); 778 gGL.blendFunc( GL_ONE, GL_ZERO );
774 779
775 { 780 {
776 LLImageGL* image_gl = gTexStaticImageList.getImageGL( getInfo()->mStaticAlphaFileName, TRUE ); 781 LLImageGL* image_gl = gTexStaticImageList.getImageGL( getInfo()->mStaticAlphaFileName, TRUE );
@@ -787,19 +792,22 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height )
787 } 792 }
788 LLImageGL::unbindTexture(0, GL_TEXTURE_2D); 793 LLImageGL::unbindTexture(0, GL_TEXTURE_2D);
789 794
795 gGL.flush();
790 glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); 796 glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
791 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); 797 gGL.blendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
792 } 798 }
793 else 799 else
794 if( getInfo()->mClearAlpha ) 800 if( getInfo()->mClearAlpha )
795 { 801 {
796 // Set the alpha channel to one (clean up after previous blending) 802 // Set the alpha channel to one (clean up after previous blending)
797 LLGLSNoTextureNoAlphaTest gls_no_alpha; 803 LLGLSNoTextureNoAlphaTest gls_no_alpha;
798 glColor4f( 0.f, 0.f, 0.f, 1.f ); 804 gGL.color4f( 0.f, 0.f, 0.f, 1.f );
805 gGL.flush();
799 glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE ); 806 glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE );
800 807
801 gl_rect_2d_simple( width, height ); 808 gl_rect_2d_simple( width, height );
802 809
810 gGL.flush();
803 glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE ); 811 glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
804 } 812 }
805 stop_glerror(); 813 stop_glerror();
@@ -827,7 +835,7 @@ BOOL LLTexLayerSet::renderBump( S32 x, S32 y, S32 width, S32 height )
827 835
828 // Set the alpha channel to one (clean up after previous blending) 836 // Set the alpha channel to one (clean up after previous blending)
829 LLGLSNoTextureNoAlphaTest gls_no_texture_no_alpha; 837 LLGLSNoTextureNoAlphaTest gls_no_texture_no_alpha;
830 glColor4f( 0.f, 0.f, 0.f, 1.f ); 838 gGL.color4f( 0.f, 0.f, 0.f, 1.f );
831 glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE ); 839 glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE );
832 840
833 gl_rect_2d_simple( width, height ); 841 gl_rect_2d_simple( width, height );
@@ -1321,14 +1329,16 @@ BOOL LLTexLayer::render( S32 x, S32 y, S32 width, S32 height )
1321 1329
1322 renderAlphaMasks( x, y, width, height, &net_color ); 1330 renderAlphaMasks( x, y, width, height, &net_color );
1323 alpha_mask_specified = TRUE; 1331 alpha_mask_specified = TRUE;
1324 glBlendFunc( GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA ); 1332 gGL.flush();
1333 gGL.blendFunc( GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA );
1325 } 1334 }
1326 1335
1327 glColor4fv( net_color.mV); 1336 gGL.color4fv( net_color.mV);
1328 1337
1329 if( getInfo()->mWriteAllChannels ) 1338 if( getInfo()->mWriteAllChannels )
1330 { 1339 {
1331 glBlendFunc( GL_ONE, GL_ZERO ); 1340 gGL.flush();
1341 gGL.blendFunc( GL_ONE, GL_ZERO );
1332 } 1342 }
1333 1343
1334 if( (getInfo()->mLocalTexture != -1) && !getInfo()->mUseLocalTextureAlphaOnly ) 1344 if( (getInfo()->mLocalTexture != -1) && !getInfo()->mUseLocalTextureAlphaOnly )
@@ -1383,14 +1393,15 @@ BOOL LLTexLayer::render( S32 x, S32 y, S32 width, S32 height )
1383 color_specified ) 1393 color_specified )
1384 { 1394 {
1385 LLGLSNoTextureNoAlphaTest gls; 1395 LLGLSNoTextureNoAlphaTest gls;
1386 glColor4fv( net_color.mV); 1396 gGL.color4fv( net_color.mV);
1387 gl_rect_2d_simple( width, height ); 1397 gl_rect_2d_simple( width, height );
1388 } 1398 }
1389 1399
1390 if( alpha_mask_specified || getInfo()->mWriteAllChannels ) 1400 if( alpha_mask_specified || getInfo()->mWriteAllChannels )
1391 { 1401 {
1392 // Restore standard blend func value 1402 // Restore standard blend func value
1393 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); 1403 gGL.flush();
1404 gGL.blendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
1394 stop_glerror(); 1405 stop_glerror();
1395 } 1406 }
1396 1407
@@ -1506,15 +1517,16 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4
1506 LLGLSNoTextureNoAlphaTest gls_no_texture_no_alpha_test; 1517 LLGLSNoTextureNoAlphaTest gls_no_texture_no_alpha_test;
1507 1518
1508 // Clear the alpha 1519 // Clear the alpha
1509 glBlendFunc( GL_ONE, GL_ZERO ); 1520 gGL.flush();
1521 gGL.blendFunc( GL_ONE, GL_ZERO );
1510 1522
1511 glColor4f( 0.f, 0.f, 0.f, 0.f ); 1523 gGL.color4f( 0.f, 0.f, 0.f, 0.f );
1512 gl_rect_2d_simple( width, height ); 1524 gl_rect_2d_simple( width, height );
1513 } 1525 }
1514 1526
1515 // Accumulate alphas 1527 // Accumulate alphas
1516 LLGLSNoAlphaTest gls_no_alpha_test; 1528 LLGLSNoAlphaTest gls_no_alpha_test;
1517 glColor4f( 1.f, 1.f, 1.f, 1.f ); 1529 gGL.color4f( 1.f, 1.f, 1.f, 1.f );
1518 1530
1519 for( iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++ ) 1531 for( iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++ )
1520 { 1532 {
@@ -1523,7 +1535,8 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4
1523 } 1535 }
1524 1536
1525 // Approximates a min() function 1537 // Approximates a min() function
1526 glBlendFunc( GL_DST_ALPHA, GL_ZERO ); 1538 gGL.flush();
1539 gGL.blendFunc( GL_DST_ALPHA, GL_ZERO );
1527 1540
1528 // Accumulate the alpha component of the texture 1541 // Accumulate the alpha component of the texture
1529 if( getInfo()->mLocalTexture != -1 ) 1542 if( getInfo()->mLocalTexture != -1 )
@@ -1577,11 +1590,11 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4
1577 } 1590 }
1578 1591
1579 // Draw a rectangle with the layer color to multiply the alpha by that color's alpha. 1592 // Draw a rectangle with the layer color to multiply the alpha by that color's alpha.
1580 // Note: we're still using glBlendFunc( GL_DST_ALPHA, GL_ZERO ); 1593 // Note: we're still using gGL.blendFunc( GL_DST_ALPHA, GL_ZERO );
1581 if( colorp->mV[VW] != 1.f ) 1594 if( colorp->mV[VW] != 1.f )
1582 { 1595 {
1583 LLGLSNoTextureNoAlphaTest gls_no_texture_no_alpha_test; 1596 LLGLSNoTextureNoAlphaTest gls_no_texture_no_alpha_test;
1584 glColor4fv( colorp->mV ); 1597 gGL.color4fv( colorp->mV );
1585 gl_rect_2d_simple( width, height ); 1598 gl_rect_2d_simple( width, height );
1586 } 1599 }
1587 1600
@@ -1947,13 +1960,14 @@ BOOL LLTexLayerParamAlpha::render( S32 x, S32 y, S32 width, S32 height )
1947 return success; 1960 return success;
1948 } 1961 }
1949 1962
1963 gGL.flush();
1950 if( getInfo()->mMultiplyBlend ) 1964 if( getInfo()->mMultiplyBlend )
1951 { 1965 {
1952 glBlendFunc( GL_DST_ALPHA, GL_ZERO ); // Multiplication: approximates a min() function 1966 gGL.blendFunc( GL_DST_ALPHA, GL_ZERO ); // Multiplication: approximates a min() function
1953 } 1967 }
1954 else 1968 else
1955 { 1969 {
1956 glBlendFunc( GL_ONE, GL_ONE ); // Addition: approximates a max() function 1970 gGL.blendFunc( GL_ONE, GL_ONE ); // Addition: approximates a max() function
1957 } 1971 }
1958 1972
1959 if( !getInfo()->mStaticImageFileName.empty() && !mStaticImageInvalid) 1973 if( !getInfo()->mStaticImageFileName.empty() && !mStaticImageInvalid)
@@ -2069,7 +2083,7 @@ BOOL LLTexLayerParamAlpha::render( S32 x, S32 y, S32 width, S32 height )
2069 else 2083 else
2070 { 2084 {
2071 LLGLSNoTextureNoAlphaTest gls_no_texture_no_alpha_test; 2085 LLGLSNoTextureNoAlphaTest gls_no_texture_no_alpha_test;
2072 glColor4f( 0.f, 0.f, 0.f, effective_weight ); 2086 gGL.color4f( 0.f, 0.f, 0.f, effective_weight );
2073 gl_rect_2d_simple( width, height ); 2087 gl_rect_2d_simple( width, height );
2074 } 2088 }
2075 2089