diff options
author | Mark Palange <palange@lindenlab.com> | 2009-01-13 03:46:56 +0000 |
---|---|---|
committer | Mark Palange <palange@lindenlab.com> | 2009-01-13 03:46:56 +0000 |
commit | 446c55538e1fb12d8a1feb541edf99c16bb29121 (patch) | |
tree | 022ca3c10bd2e0326098719cdffb65f9465ab08f /indra/newview/llmaniptranslate.cpp | |
parent | 5476aca88e4b34d4d145f3a0b04fce95402c7b1f (diff) |
svn merge -r106055-107012 svn+ssh://svn.lindenlab.com/svn/linden/branches/viewer/viewer_1-22/
merge RC5 changes into trunk, plus add'l localization xml (all newly added) files that should have been added with RC0-RC4 merge, but weren't.
Diffstat (limited to 'indra/newview/llmaniptranslate.cpp')
-rw-r--r-- | indra/newview/llmaniptranslate.cpp | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index 8c0c5fdab1..b9a700991e 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -78,7 +78,7 @@ const F32 PLANE_TICK_SIZE = 0.4f; const F32 MANIPULATOR_SCALE_HALF_LIFE = 0.07f; const F32 SNAP_ARROW_SCALE = 0.7f; -static GLuint sGridTex = 0; +static LLPointer<LLImageGL> sGridTex = NULL ; const LLManip::EManipPart MANIPULATOR_IDS[9] = { @@ -120,22 +120,50 @@ LLManipTranslate::LLManipTranslate( LLToolComposite* composite ) mPlaneScales(1.f, 1.f, 1.f), mPlaneManipPositions(1.f, 1.f, 1.f, 1.f) { - if (sGridTex == 0) + if (sGridTex.isNull()) { restoreGL(); } } //static +U32 LLManipTranslate::getGridTexName() +{ + if(sGridTex.isNull()) + { + restoreGL() ; + } + + return sGridTex.isNull() ? 0 : sGridTex->getTexName() ; +} + +//static +void LLManipTranslate::destroyGL() +{ + if (sGridTex) + { + sGridTex = NULL ; + } +} + +//static void LLManipTranslate::restoreGL() { //generate grid texture U32 rez = 512; U32 mip = 0; - GLuint* d = new GLuint[rez*rez]; - glGenTextures(1, &sGridTex); - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, sGridTex); + destroyGL() ; + sGridTex = new LLImageGL() ; + if(!sGridTex->createGLTexture()) + { + sGridTex = NULL ; + return ; + } + + GLuint* d = new GLuint[rez*rez]; + + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, sGridTex->getTexName()); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); @@ -1504,7 +1532,7 @@ void LLManipTranslate::renderSnapGuides() LLGLDisable stencil(GL_STENCIL_TEST); { LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GREATER); - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, sGridTex); + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, getGridTexName()); gGL.flush(); gGL.blendFunc(LLRender::BF_ZERO, LLRender::BF_ONE_MINUS_SOURCE_ALPHA); renderGrid(u,v,tiles,0.9f, 0.9f, 0.9f,a*0.15f); @@ -1519,7 +1547,7 @@ void LLManipTranslate::renderSnapGuides() renderGrid(u,v,tiles,0.0f, 0.0f, 0.0f,a*0.16f); //draw grid top - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, sGridTex); + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, getGridTexName()); renderGrid(u,v,tiles,1,1,1,a); gGL.popMatrix(); |