diff options
author | Dave Parks <davep@lindenlab.com> | 2011-09-14 16:30:45 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-09-14 16:30:45 -0500 |
commit | 7c95af74f195c9ec4ebc0fc0264d98cd4a85be49 (patch) | |
tree | 1bab2f431bd1df1e9f6f7058cad8d64119ec3bd3 | |
parent | c0ca2c62fd6b9a90542907ce46bf1fe0ab379e13 (diff) |
SH-2243 work in progress -- application side matrix stack management
55 files changed, 876 insertions, 654 deletions
diff --git a/indra/llrender/llcubemap.cpp b/indra/llrender/llcubemap.cpp index 1b10354c22..5eb29efbfa 100644 --- a/indra/llrender/llcubemap.cpp +++ b/indra/llrender/llcubemap.cpp @@ -273,10 +273,10 @@ void LLCubeMap::setMatrix(S32 stage) LLMatrix4 trans(mat3); trans.transpose(); - glMatrixMode(GL_TEXTURE); - glPushMatrix(); - glLoadMatrixf((F32 *)trans.mMatrix); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.pushMatrix(); + gGL.loadMatrix((F32 *)trans.mMatrix); + gGL.matrixMode(LLRender::MM_MODELVIEW); /*if (stage > 0) { @@ -292,9 +292,9 @@ void LLCubeMap::restoreMatrix() { gGL.getTexUnit(mMatrixStage)->activate(); } - glMatrixMode(GL_TEXTURE); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); /*if (mMatrixStage > 0) { diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 1a2fe0ea0e..1667afe179 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -1195,7 +1195,7 @@ void rotate_quat(LLQuaternion& rotation) { F32 angle_radians, x, y, z; rotation.getAngleAxis(&angle_radians, &x, &y, &z); - glRotatef(angle_radians * RAD_TO_DEG, x, y, z); + gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z); } void flush_glerror() @@ -1987,20 +1987,20 @@ void LLGLUserClipPlane::setPlane(F32 a, F32 b, F32 c, F32 d) glh::matrix4f suffix; suffix.set_row(2, cplane); glh::matrix4f newP = suffix * P; - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadMatrixf(newP.m); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); + gGL.loadMatrix(newP.m); gGLObliqueProjectionInverse = LLMatrix4(newP.inverse().transpose().m); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); } LLGLUserClipPlane::~LLGLUserClipPlane() { if (mApply) { - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); } } @@ -2190,16 +2190,16 @@ LLGLSquashToFarClip::LLGLSquashToFarClip(glh::matrix4f P, U32 layer) P.element(2, i) = P.element(3, i) * depth; } - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadMatrixf(P.m); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); + gGL.loadMatrix(P.m); + gGL.matrixMode(LLRender::MM_MODELVIEW); } LLGLSquashToFarClip::~LLGLSquashToFarClip() { - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); } diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index d76b2d9004..c0045c8044 100644 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -466,21 +466,21 @@ void LLPostProcess::drawOrthoQuad(unsigned int width, unsigned int height, QuadT void LLPostProcess::viewOrthogonal(unsigned int width, unsigned int height) { - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - glOrtho( 0.f, (GLdouble) width , (GLdouble) height , 0.f, -1.f, 1.f ); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); + gGL.loadIdentity(); + gGL.ortho( 0.f, (GLdouble) width , (GLdouble) height , 0.f, -1.f, 1.f ); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); + gGL.loadIdentity(); } void LLPostProcess::viewPerspective(void) { - glMatrixMode( GL_PROJECTION ); - glPopMatrix(); - glMatrixMode( GL_MODELVIEW ); - glPopMatrix(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.popMatrix(); } void LLPostProcess::changeOrthogonal(unsigned int width, unsigned int height) diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 426419f912..27d25c0d3a 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -951,6 +951,15 @@ LLRender::LLRender() mCurrBlendAlphaSFactor = BF_UNDEF; mCurrBlendColorDFactor = BF_UNDEF; mCurrBlendAlphaDFactor = BF_UNDEF; + + mMatrixMode = LLRender::MM_MODELVIEW; + + for (U32 i = 0; i < NUM_MATRIX_MODES; ++i) + { + mMatIdx[i] = 0; + mMatHash[i] = 0; + mCurMatHash[i] = 0xFFFFFFFF; + } } LLRender::~LLRender() @@ -1007,28 +1016,182 @@ void LLRender::refreshState(void) mDirty = false; } +void LLRender::syncMatrices() +{ + GLenum mode[] = + { + GL_MODELVIEW, + GL_PROJECTION, + GL_TEXTURE, + GL_TEXTURE, + GL_TEXTURE, + GL_TEXTURE, + }; + + for (U32 i = 0; i < 2; ++i) + { + if (mMatHash[i] != mCurMatHash[i]) + { + glMatrixMode(mode[i]); + glLoadMatrixf(mMatrix[i][mMatIdx[i]].m); + mCurMatHash[i] = mMatHash[i]; + } + } + + for (U32 i = 2; i < NUM_MATRIX_MODES; ++i) + { + if (mMatHash[i] != mCurMatHash[i]) + { + gGL.getTexUnit(i-2)->activate(); + glMatrixMode(mode[i]); + glLoadMatrixf(mMatrix[i][mMatIdx[i]].m); + mCurMatHash[i] = mMatHash[i]; + } + } + +} + void LLRender::translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z) { flush(); - glTranslatef(x,y,z); + + glh::matrix4f trans_mat(1,0,0,x, + 0,1,0,y, + 0,0,1,z, + 0,0,0,1); + + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].mult_right(trans_mat); + mMatHash[mMatrixMode]++; } void LLRender::scalef(const GLfloat& x, const GLfloat& y, const GLfloat& z) { flush(); - glScalef(x,y,z); + + glh::matrix4f scale_mat(x,0,0,0, + 0,y,0,0, + 0,0,z,0, + 0,0,0,1); + + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].mult_right(scale_mat); + mMatHash[mMatrixMode]++; +} + +void LLRender::ortho(F32 left, F32 right, F32 bottom, F32 top, F32 zNear, F32 zFar) +{ + flush(); + + glh::matrix4f ortho_mat(2.f/(right-left),0,0, -(right+left)/(right-left), + 0,2.f/(top-bottom),0, -(top+bottom)/(top-bottom), + 0,0,-2.f/(zFar-zNear), -(zFar+zNear)/(zFar-zNear), + 0,0,0,1); + + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].mult_right(ortho_mat); + mMatHash[mMatrixMode]++; +} + +void LLRender::rotatef(const GLfloat& a, const GLfloat& x, const GLfloat& y, const GLfloat& z) +{ + flush(); + + F32 r = a * DEG_TO_RAD; + + F32 c = cosf(r); + F32 s = sinf(r); + + F32 ic = 1.f-c; + + glh::matrix4f rot_mat(x*x*ic+c, x*y*ic-z*s, x*z*ic+y*s, 0, + x*y*ic+z*s, y*y*ic+c, y*z*ic-x*s, 0, + x*z*ic-y*s, y*z*ic+x*s, z*z*ic+c, 0, + 0,0,0,1); + + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].mult_right(rot_mat); + mMatHash[mMatrixMode]++; } void LLRender::pushMatrix() { flush(); - glPushMatrix(); + + if (mMatIdx[mMatrixMode] < LL_MATRIX_STACK_DEPTH-1) + { + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]+1] = mMatrix[mMatrixMode][mMatIdx[mMatrixMode]]; + ++mMatIdx[mMatrixMode]; + } + else + { + llwarns << "Matrix stack overflow." << llendl; + } } void LLRender::popMatrix() { flush(); - glPopMatrix(); + if (mMatIdx[mMatrixMode] > 0) + { + --mMatIdx[mMatrixMode]; + mMatHash[mMatrixMode]++; + } + else + { + llwarns << "Matrix stack underflow." << llendl; + } +} + +void LLRender::loadMatrix(const GLfloat* m) +{ + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].set_value((GLfloat*) m); + mMatHash[mMatrixMode]++; +} + +void LLRender::loadMatrix(const GLdouble* dm) +{ + F32 m[16]; + for (U32 i = 0; i < 16; i++) + { + m[i] = (F32) dm[i]; + } + + loadMatrix(m); +} + +void LLRender::multMatrix(const GLfloat* m) +{ + flush(); + + glh::matrix4f mat((GLfloat*) m); + + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].mult_right(mat); + mMatHash[mMatrixMode]++; +} + +void LLRender::matrixMode(U32 mode) +{ + if (mode == MM_TEXTURE) + { + mode = MM_TEXTURE0 + gGL.getCurrentTexUnitIndex(); + } + + llassert(mode < NUM_MATRIX_MODES); + mMatrixMode = mode; +} + +void LLRender::multMatrix(const GLdouble* dm) +{ + F32 m[16]; + for (U32 i = 0; i < 16; i++) + { + m[i] = (F32) dm[i]; + } + + multMatrix(m); +} + +void LLRender::loadIdentity() +{ + mMatrix[mMatrixMode][mMatIdx[mMatrixMode]].make_identity(); + mMatHash[mMatrixMode]++; } void LLRender::translateUI(F32 x, F32 y, F32 z) @@ -1421,12 +1584,16 @@ void LLRender::flush() } } + //store mCount in a local variable to avoid re-entrance (drawArrays may call flush) + U32 count = mCount; + mCount = 0; + mBuffer->setBuffer(immediate_mask); - mBuffer->drawArrays(mMode, 0, mCount); + mBuffer->drawArrays(mMode, 0, count); - mVerticesp[0] = mVerticesp[mCount]; - mTexcoordsp[0] = mTexcoordsp[mCount]; - mColorsp[0] = mColorsp[mCount]; + mVerticesp[0] = mVerticesp[count]; + mTexcoordsp[0] = mTexcoordsp[count]; + mColorsp[0] = mColorsp[count]; mCount = 0; } } diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index c202aa4b73..465c16f0de 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -41,6 +41,8 @@ #include "llstrider.h" #include "llpointer.h" #include "llglheaders.h" +#include "llmatrix4a.h" +#include "glh/glh_linear.h" class LLVertexBuffer; class LLCubeMap; @@ -48,6 +50,8 @@ class LLImageGL; class LLRenderTarget; class LLTexture ; +#define LL_MATRIX_STACK_DEPTH 32 + class LLTexUnit { friend class LLRender; @@ -308,6 +312,18 @@ public: BF_UNDEF } eBlendFactor; + typedef enum + { + MM_MODELVIEW = 0, + MM_PROJECTION, + MM_TEXTURE0, + MM_TEXTURE1, + MM_TEXTURE2, + MM_TEXTURE3, + NUM_MATRIX_MODES, + MM_TEXTURE + } eMatrixMode; + LLRender(); ~LLRender(); void init() ; @@ -319,8 +335,19 @@ public: void translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z); void scalef(const GLfloat& x, const GLfloat& y, const GLfloat& z); + void rotatef(const GLfloat& a, const GLfloat& x, const GLfloat& y, const GLfloat& z); + void ortho(F32 left, F32 right, F32 bottom, F32 top, F32 zNear, F32 zFar); + void pushMatrix(); void popMatrix(); + void loadMatrix(const GLfloat* m); + void loadMatrix(const GLdouble* m); + void loadIdentity(); + void multMatrix(const GLfloat* m); + void multMatrix(const GLdouble* m); + void matrixMode(U32 mode); + + void syncMatrices(); void translateUI(F32 x, F32 y, F32 z); void scaleUI(F32 x, F32 y, F32 z); @@ -397,7 +424,14 @@ public: static U32 sUIVerts; private: - bool mDirty; + U32 mMatrixMode; + U32 mMatIdx[NUM_MATRIX_MODES]; + U32 mMatHash[NUM_MATRIX_MODES]; + glh::matrix4f mMatrix[NUM_MATRIX_MODES][LL_MATRIX_STACK_DEPTH]; + + U32 mCurMatHash[NUM_MATRIX_MODES]; + + bool mDirty; U32 mCount; U32 mMode; U32 mCurrTextureUnitIndex; diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index bb8f067e8d..090da765ac 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -63,10 +63,8 @@ U32 LLVertexBuffer::sAllocatedBytes = 0; BOOL LLVertexBuffer::sMapped = FALSE; BOOL LLVertexBuffer::sUseStreamDraw = TRUE; BOOL LLVertexBuffer::sPreferStreamDraw = FALSE; - std::vector<U32> LLVertexBuffer::sDeleteList; - const U32 FENCE_WAIT_TIME_NANOSECONDS = 10000; //1 ms class LLGLSyncFence : public LLGLFence @@ -149,6 +147,7 @@ U32 LLVertexBuffer::sGLMode[LLRender::NUM_MODES] = GL_LINE_LOOP, }; + //static void LLVertexBuffer::setupClientArrays(U32 data_mask) { @@ -356,6 +355,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) void LLVertexBuffer::drawArrays(U32 mode, const std::vector<LLVector3>& pos, const std::vector<LLVector3>& norm) { llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); + gGL.syncMatrices(); U32 count = pos.size(); llassert_always(norm.size() >= pos.size()); @@ -394,6 +394,8 @@ void LLVertexBuffer::drawElements(U32 mode, const LLVector4a* pos, const LLVecto { llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); + gGL.syncMatrices(); + U32 mask = LLVertexBuffer::MAP_VERTEX; if (tc) { @@ -465,6 +467,8 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi { validateRange(start, end, count, indices_offset); + gGL.syncMatrices(); + llassert(mRequestedNumVerts >= 0); llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); @@ -497,6 +501,8 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const { llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); + gGL.syncMatrices(); + llassert(mRequestedNumIndices >= 0); if (indices_offset >= (U32) mRequestedNumIndices || indices_offset + count > (U32) mRequestedNumIndices) @@ -530,7 +536,9 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const { llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); - + + gGL.syncMatrices(); + llassert(mRequestedNumVerts >= 0); if (first >= (U32) mRequestedNumVerts || first + count > (U32) mRequestedNumVerts) diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 6afe276379..e832b6bbeb 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -973,7 +973,7 @@ void LLAccordionCtrlTab::drawChild(const LLRect& root_rect,LLView* child) if ( root_rect.overlaps(screen_rect) && LLUI::sDirtyRect.overlaps(screen_rect)) { - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); LLUI::pushMatrix(); { LLUI::translate((F32)child->getRect().mLeft, (F32)child->getRect().mBottom, 0.f); diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 58ba9e05f5..b7894f5bf7 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -150,11 +150,11 @@ void gl_state_for_2d(S32 width, S32 height) F32 window_width = (F32) width;//gViewerWindow->getWindowWidth(); F32 window_height = (F32) height;//gViewerWindow->getWindowHeight(); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0.0f, llmax(window_width, 1.f), 0.0f, llmax(window_height,1.f), -1.0f, 1.0f); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.loadIdentity(); + gGL.ortho(0.0f, llmax(window_width, 1.f), 0.0f, llmax(window_height,1.f), -1.0f, 1.0f); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.loadIdentity(); stop_glerror(); } diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 659a54cc6e..c16481c1c8 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1433,7 +1433,7 @@ void LLView::drawChild(LLView* childp, S32 x_offset, S32 y_offset, BOOL force_dr if ((childp->getVisible() && childp->getRect().isValid()) || force_draw) { - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); LLUI::pushMatrix(); { LLUI::translate((F32)childp->getRect().mLeft + x_offset, (F32)childp->getRect().mBottom + y_offset, 0.f); diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 64a5884e14..48afe77827 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -3918,7 +3918,7 @@ void LLAgent::renderAutoPilotTarget() F32 height_meters; LLVector3d target_global; - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); // not textured @@ -3933,7 +3933,7 @@ void LLAgent::renderAutoPilotTarget() height_meters = 1.f; - glScalef(height_meters, height_meters, height_meters); + gGL.scalef(height_meters, height_meters, height_meters); gSphere.render(); diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 0c572def72..35f8a85796 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -457,10 +457,10 @@ void LLRenderPass::applyModelMatrix(LLDrawInfo& params) if (params.mModelMatrix != gGLLastMatrix) { gGLLastMatrix = params.mModelMatrix; - glLoadMatrixd(gGLModelView); + gGL.loadMatrix(gGLModelView); if (params.mModelMatrix) { - glMultMatrixf((GLfloat*) params.mModelMatrix->mMatrix); + gGL.multMatrix((GLfloat*) params.mModelMatrix->mMatrix); } gPipeline.mMatrixOpCount++; } @@ -494,8 +494,8 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL ba { tex_setup = true; gGL.getTexUnit(0)->activate(); - glMatrixMode(GL_TEXTURE); - glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix); gPipeline.mTextureMatrixOps++; } } @@ -519,8 +519,8 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL ba if (tex_setup) { - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); } } diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 1e04cd9c17..a5032d007f 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -475,8 +475,8 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) { tex_setup = true; gGL.getTexUnit(0)->activate(); - glMatrixMode(GL_TEXTURE); - glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix); gPipeline.mTextureMatrixOps++; } } @@ -517,8 +517,8 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask) if (tex_setup) { gGL.getTexUnit(0)->activate(); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); } } } diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 96c4efde3d..f161790b99 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1502,11 +1502,11 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) if (face->mTextureMatrix) { - glMatrixMode(GL_TEXTURE); - glLoadMatrixf((F32*) face->mTextureMatrix->mMatrix); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadMatrix((F32*) face->mTextureMatrix->mMatrix); buff->drawRange(LLRender::TRIANGLES, start, end, count, offset); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); } else { diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 0c3e93cd8a..501bd88970 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -1369,18 +1369,18 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL if (mShiny) { gGL.getTexUnit(0)->activate(); - glMatrixMode(GL_TEXTURE); + gGL.matrixMode(LLRender::MM_TEXTURE); } else { gGL.getTexUnit(1)->activate(); - glMatrixMode(GL_TEXTURE); - glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix); gPipeline.mTextureMatrixOps++; gGL.getTexUnit(0)->activate(); } - glLoadMatrixf((GLfloat*) params.mTextureMatrix->mMatrix); + gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix); gPipeline.mTextureMatrixOps++; tex_setup = true; @@ -1416,11 +1416,11 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL else { gGL.getTexUnit(1)->activate(); - glLoadIdentity(); + gGL.loadIdentity(); gGL.getTexUnit(0)->activate(); } - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); } } @@ -1465,6 +1465,7 @@ void LLDrawPoolInvisible::endDeferredPass( S32 pass ) void LLDrawPoolInvisible::renderDeferred( S32 pass ) { //render invisiprims; this doesn't work becaue it also blocks all the post-deferred stuff +#if 0 LLFastTimer t(FTM_RENDER_INVISIBLE); U32 invisi_mask = LLVertexBuffer::MAP_VERTEX; @@ -1482,4 +1483,5 @@ void LLDrawPoolInvisible::renderDeferred( S32 pass ) renderShiny(true); endShiny(true); } +#endif } diff --git a/indra/newview/lldrawpoolground.cpp b/indra/newview/lldrawpoolground.cpp index ce07e62122..59c3fbf7a1 100644 --- a/indra/newview/lldrawpoolground.cpp +++ b/indra/newview/lldrawpoolground.cpp @@ -71,9 +71,9 @@ void LLDrawPoolGround::render(S32 pass) LLGLSquashToFarClip far_clip(glh_get_current_projection()); F32 water_height = gAgent.getRegion()->getWaterHeight(); - glPushMatrix(); + gGL.pushMatrix(); LLVector3 origin = LLViewerCamera::getInstance()->getOrigin(); - glTranslatef(origin.mV[0], origin.mV[1], llmax(origin.mV[2], water_height)); + gGL.translatef(origin.mV[0], origin.mV[1], llmax(origin.mV[2], water_height)); LLFace *facep = mDrawFace[0]; @@ -82,6 +82,6 @@ void LLDrawPoolGround::render(S32 pass) LLOverrideFaceColor col(this, gSky.mVOSkyp->getGLFogColor()); facep->renderIndexed(); - glPopMatrix(); + gGL.popMatrix(); } diff --git a/indra/newview/lldrawpoolsky.cpp b/indra/newview/lldrawpoolsky.cpp index d1c8fa5fc9..8a3871b6b4 100644 --- a/indra/newview/lldrawpoolsky.cpp +++ b/indra/newview/lldrawpoolsky.cpp @@ -111,9 +111,9 @@ void LLDrawPoolSky::render(S32 pass) LLGLDisable clip(GL_CLIP_PLANE0); - glPushMatrix(); + gGL.pushMatrix(); LLVector3 origin = LLViewerCamera::getInstance()->getOrigin(); - glTranslatef(origin.mV[0], origin.mV[1], origin.mV[2]); + gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]); S32 face_count = (S32)mDrawFace.size(); @@ -125,7 +125,7 @@ void LLDrawPoolSky::render(S32 pass) renderSkyCubeFace(i); } - glPopMatrix(); + gGL.popMatrix(); } void LLDrawPoolSky::renderSkyCubeFace(U8 side) diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 8d6b31912a..3ba4a89686 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -323,9 +323,9 @@ void LLDrawPoolTerrain::renderFullShader() glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); // // detail texture 1 @@ -335,9 +335,9 @@ void LLDrawPoolTerrain::renderFullShader() /// ALPHA TEXTURE COORDS 0: gGL.getTexUnit(1)->activate(); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); // detail texture 2 // @@ -347,10 +347,10 @@ void LLDrawPoolTerrain::renderFullShader() gGL.getTexUnit(2)->activate(); /// ALPHA TEXTURE COORDS 1: - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glTranslatef(-2.f, 0.f, 0.f); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.translatef(-2.f, 0.f, 0.f); + gGL.matrixMode(LLRender::MM_MODELVIEW); // // detail texture 3 @@ -360,10 +360,10 @@ void LLDrawPoolTerrain::renderFullShader() /// ALPHA TEXTURE COORDS 2: gGL.getTexUnit(3)->activate(); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glTranslatef(-1.f, 0.f, 0.f); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.translatef(-1.f, 0.f, 0.f); + gGL.matrixMode(LLRender::MM_MODELVIEW); // // Alpha Ramp @@ -386,36 +386,33 @@ void LLDrawPoolTerrain::renderFullShader() gGL.getTexUnit(4)->activate(); glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); - + gGL.getTexUnit(detail3)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(3)->disable(); gGL.getTexUnit(3)->activate(); glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.getTexUnit(detail2)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(2)->disable(); gGL.getTexUnit(2)->activate(); glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.getTexUnit(detail1)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(1)->disable(); gGL.getTexUnit(1)->activate(); glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); //---------------------------------------------------------------------------- // Restore Texture Unit 0 defaults @@ -425,9 +422,9 @@ void LLDrawPoolTerrain::renderFullShader() gGL.getTexUnit(0)->activate(); glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); } void LLDrawPoolTerrain::renderFull4TU() @@ -538,9 +535,9 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.getTexUnit(1)->activate(); // Set the texture matrix - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glTranslatef(-2.f, 0.f, 0.f); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.translatef(-2.f, 0.f, 0.f); // Care about alpha only gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); @@ -570,9 +567,9 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.getTexUnit(3)->activate(); // Set the texture matrix - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glTranslatef(-1.f, 0.f, 0.f); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.translatef(-1.f, 0.f, 0.f); // Set alpha texture and do lighting modulation gGL.getTexUnit(3)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_VERT_COLOR); @@ -590,9 +587,9 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.getTexUnit(3)->disable(); gGL.getTexUnit(3)->activate(); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.getTexUnit(2)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(2)->disable(); @@ -600,17 +597,17 @@ void LLDrawPoolTerrain::renderFull4TU() glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(1)->disable(); gGL.getTexUnit(1)->activate(); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); // Restore blend state gGL.setSceneBlendType(LLRender::BT_ALPHA); @@ -624,9 +621,9 @@ void LLDrawPoolTerrain::renderFull4TU() glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); } @@ -718,9 +715,9 @@ void LLDrawPoolTerrain::renderFull2TU() gGL.getTexUnit(0)->bind(m2DAlphaRampImagep); // Set the texture matrix - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glTranslatef(-1.f, 0.f, 0.f); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.translatef(-1.f, 0.f, 0.f); // Care about alpha only gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); @@ -757,9 +754,9 @@ void LLDrawPoolTerrain::renderFull2TU() gGL.getTexUnit(0)->activate(); gGL.getTexUnit(0)->bind(m2DAlphaRampImagep); // Set the texture matrix - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glTranslatef(-2.f, 0.f, 0.f); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.translatef(-2.f, 0.f, 0.f); // Care about alpha only gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); @@ -797,9 +794,9 @@ void LLDrawPoolTerrain::renderFull2TU() glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); //---------------------------------------------------------------------------- // Restore Texture Unit 0 defaults @@ -809,9 +806,9 @@ void LLDrawPoolTerrain::renderFull2TU() glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); } @@ -853,9 +850,9 @@ void LLDrawPoolTerrain::renderSimple() gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); } @@ -886,11 +883,11 @@ void LLDrawPoolTerrain::renderOwnership() // texture coordinates for pixel 256x256 is not 1,1. This makes the // ownership map not line up with the selection. We address this with // a texture matrix multiply. - glMatrixMode(GL_TEXTURE); - glPushMatrix(); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.pushMatrix(); const F32 TEXTURE_FUDGE = 257.f / 256.f; - glScalef( TEXTURE_FUDGE, TEXTURE_FUDGE, 1.f ); + gGL.scalef( TEXTURE_FUDGE, TEXTURE_FUDGE, 1.f ); for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); iter != mDrawFace.end(); iter++) { @@ -899,9 +896,9 @@ void LLDrawPoolTerrain::renderOwnership() LLVertexBuffer::MAP_TEXCOORD0); } - glMatrixMode(GL_TEXTURE); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); } diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index da8e3e8b3a..3fe5b4d929 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -197,7 +197,7 @@ void LLDrawPoolTree::renderTree(BOOL selecting) U32 indices_drawn = 0; - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); iter != mDrawFace.end(); iter++) @@ -228,8 +228,8 @@ void LLDrawPoolTree::renderTree(BOOL selecting) } gGLLastMatrix = NULL; - glLoadMatrixd(gGLModelView); - //glPushMatrix(); + gGL.loadMatrix(gGLModelView); + //gGL.pushMatrix(); F32 mat[16]; for (U32 i = 0; i < 16; i++) mat[i] = (F32) gGLModelView[i]; @@ -238,7 +238,7 @@ void LLDrawPoolTree::renderTree(BOOL selecting) // Translate to tree base HACK - adjustment in Z plants tree underground const LLVector3 &pos_agent = treep->getPositionAgent(); - //glTranslatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f); + //gGL.translatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f); LLMatrix4 trans_mat; trans_mat.setTranslation(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f); trans_mat *= matrix; @@ -309,7 +309,7 @@ void LLDrawPoolTree::renderTree(BOOL selecting) indices_drawn += treep->drawBranchPipeline(scale_mat, indicesp, trunk_LOD, stop_depth, treep->mDepth, treep->mTrunkDepth, 1.0, treep->mTwist, droop, treep->mBranches, alpha); } - //glPopMatrix(); + //gGL.popMatrix(); } } } diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index ae1598907b..c97f92fa6f 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -275,15 +275,15 @@ void LLDrawPoolWater::render(S32 pass) gSky.mVOSkyp->getCubeMap()->enable(0); gSky.mVOSkyp->getCubeMap()->bind(); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); LLMatrix4 camera_mat = LLViewerCamera::getInstance()->getModelview(); LLMatrix4 camera_rot(camera_mat.getMat3()); camera_rot.invert(); - glLoadMatrixf((F32 *)camera_rot.mMatrix); + gGL.loadMatrix((F32 *)camera_rot.mMatrix); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); LLOverrideFaceColor overrid(this, 1.f, 1.f, 1.f, 0.5f*up_dot); gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); @@ -310,9 +310,9 @@ void LLDrawPoolWater::render(S32 pass) gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); } diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 852de39781..f2d077030c 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -130,33 +130,33 @@ void LLDrawPoolWLSky::renderDome(F32 camHeightLocal, LLGLSLShader * shader) cons llassert_always(NULL != shader); - glPushMatrix(); + gGL.pushMatrix(); //chop off translation if (LLPipeline::sReflectionRender && origin.mV[2] > 256.f) { - glTranslatef(origin.mV[0], origin.mV[1], 256.f-origin.mV[2]*0.5f); + gGL.translatef(origin.mV[0], origin.mV[1], 256.f-origin.mV[2]*0.5f); } else { - glTranslatef(origin.mV[0], origin.mV[1], origin.mV[2]); + gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]); } // the windlight sky dome works most conveniently in a coordinate system // where Y is up, so permute our basis vectors accordingly. - glRotatef(120.f, 1.f / F_SQRT3, 1.f / F_SQRT3, 1.f / F_SQRT3); + gGL.rotatef(120.f, 1.f / F_SQRT3, 1.f / F_SQRT3, 1.f / F_SQRT3); - glScalef(0.333f, 0.333f, 0.333f); + gGL.scalef(0.333f, 0.333f, 0.333f); - glTranslatef(0.f,-camHeightLocal, 0.f); + gGL.translatef(0.f,-camHeightLocal, 0.f); // Draw WL Sky shader->uniform3f("camPosLocal", 0.f, camHeightLocal, 0.f); gSky.mVOWLSkyp->drawDome(); - glPopMatrix(); + gGL.popMatrix(); } void LLDrawPoolWLSky::renderSkyHaze(F32 camHeightLocal) const @@ -197,7 +197,7 @@ void LLDrawPoolWLSky::renderStars(void) const gGL.getTexUnit(0)->bind(gSky.mVOSkyp->getBloomTex()); gGL.pushMatrix(); - glRotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f); + gGL.rotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f); // gl_FragColor.rgb = gl_Color.rgb; // gl_FragColor.a = gl_Color.a * star_alpha.a; if (LLGLSLShader::sNoFixedFunction) @@ -315,10 +315,10 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass) renderSkyHaze(camHeightLocal); LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); - glPushMatrix(); + gGL.pushMatrix(); - glTranslatef(origin.mV[0], origin.mV[1], origin.mV[2]); + gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]); gDeferredStarProgram.bind(); // *NOTE: have to bind a texture here since register combiners blending in @@ -332,7 +332,7 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass) gDeferredStarProgram.unbind(); - glPopMatrix(); + gGL.popMatrix(); renderSkyClouds(camHeightLocal); @@ -360,9 +360,9 @@ void LLDrawPoolWLSky::render(S32 pass) renderSkyHaze(camHeightLocal); LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); - glPushMatrix(); + gGL.pushMatrix(); - glTranslatef(origin.mV[0], origin.mV[1], origin.mV[2]); + gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]); // *NOTE: have to bind a texture here since register combiners blending in // renderStars() requires something to be bound and we might as well only @@ -374,7 +374,7 @@ void LLDrawPoolWLSky::render(S32 pass) renderStars(); - glPopMatrix(); + gGL.popMatrix(); renderSkyClouds(camHeightLocal); diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index f5a8013f4d..7ae11bff94 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -496,11 +496,11 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) gGL.pushMatrix(); if (mDrawablep->isActive()) { - glMultMatrixf((GLfloat*)mDrawablep->getRenderMatrix().mMatrix); + gGL.multMatrix((GLfloat*)mDrawablep->getRenderMatrix().mMatrix); } else { - glMultMatrixf((GLfloat*)mDrawablep->getRegion()->mRenderMatrix.mMatrix); + gGL.multMatrix((GLfloat*)mDrawablep->getRegion()->mRenderMatrix.mMatrix); } gGL.diffuseColor4fv(color.mV); @@ -515,7 +515,7 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) { LLGLEnable offset(GL_POLYGON_OFFSET_FILL); glPolygonOffset(-1.f, -1.f); - glMultMatrixf((F32*) volume->getRelativeXform().mMatrix); + gGL.multMatrix((F32*) volume->getRelativeXform().mMatrix); const LLVolumeFace& vol_face = rigged->getVolumeFace(getTEOffset()); LLVertexBuffer::unbind(); glVertexPointer(3, GL_FLOAT, 16, vol_face.mPositions); @@ -524,6 +524,7 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(2, GL_FLOAT, 8, vol_face.mTexCoords); } + gGL.syncMatrices(); glDrawElements(GL_TRIANGLES, vol_face.mNumIndices, GL_UNSIGNED_SHORT, vol_face.mIndices); glDisableClientState(GL_TEXTURE_COORD_ARRAY); } @@ -557,17 +558,17 @@ void LLFace::renderSelectedUV() // add green dither pattern on top of red/blue gradient gGL.blendFunc(LLRender::BF_ONE, LLRender::BF_ONE); - glMatrixMode(GL_TEXTURE); - glPushMatrix(); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.pushMatrix(); // make green pattern repeat once per texel in red/blue texture - glScalef(256.f, 256.f, 1.f); - glMatrixMode(GL_MODELVIEW); + gGL.scalef(256.f, 256.f, 1.f); + gGL.matrixMode(LLRender::MM_MODELVIEW); renderSelected(green_imagep, LLColor4::white); - glMatrixMode(GL_TEXTURE); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, LLRender::BF_ONE_MINUS_SOURCE_ALPHA); } */ @@ -2170,10 +2171,10 @@ S32 LLFace::renderElements(const U16 *index_array) const } else { - glPushMatrix(); - glMultMatrixf((float*)getRenderMatrix().mMatrix); + gGL.pushMatrix(); + gGL.multMatrix((float*)getRenderMatrix().mMatrix); ret = pushVertices(index_array); - glPopMatrix(); + gGL.popMatrix(); } return ret; diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 366154302c..c24e0014be 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -1107,10 +1107,10 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t LLPointer<LLImageRaw> scratch = new LLImageRaw(1024, 512, 3); gGL.pushMatrix(); - glLoadIdentity(); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-0.05, 1.05, -0.05, 1.05, -1.0, 1.0); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.loadIdentity(); + gGL.ortho(-0.05f, 1.05f, -0.05f, 1.05f, -1.0f, 1.0f); //render charts gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); @@ -1349,7 +1349,7 @@ void LLFastTimerView::exportCharts(const std::string& base, const std::string& t buffer.flush(); gGL.popMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.popMatrix(); } diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp index 1318dfdf2a..54b9a1f27b 100644 --- a/indra/newview/llfloateranimpreview.cpp +++ b/indra/newview/llfloateranimpreview.cpp @@ -1062,14 +1062,14 @@ BOOL LLPreviewAnimation::render() mNeedsUpdate = FALSE; LLVOAvatar* avatarp = mDummyAvatar; - glMatrixMode(GL_PROJECTION); + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); - glLoadIdentity(); - glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f); + gGL.loadIdentity(); + gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); - glLoadIdentity(); + gGL.loadIdentity(); if (LLGLSLShader::sNoFixedFunction) { @@ -1082,10 +1082,10 @@ BOOL LLPreviewAnimation::render() gl_rect_2d_simple( mFullWidth, mFullHeight ); - glMatrixMode(GL_PROJECTION); + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.popMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.popMatrix(); gGL.flush(); diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index b9c298ff9d..69de15d9ea 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -650,14 +650,14 @@ BOOL LLImagePreviewAvatar::render() gGL.pushUIMatrix(); gGL.loadUIIdentity(); - glMatrixMode(GL_PROJECTION); + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); - glLoadIdentity(); - glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f); + gGL.loadIdentity(); + gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); - glLoadIdentity(); + gGL.loadIdentity(); LLGLSUIDefault def; @@ -670,10 +670,10 @@ BOOL LLImagePreviewAvatar::render() gl_rect_2d_simple( mFullWidth, mFullHeight ); - glMatrixMode(GL_PROJECTION); + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.popMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.popMatrix(); gGL.flush(); @@ -844,14 +844,14 @@ BOOL LLImagePreviewSculpted::render() LLGLEnable cull(GL_CULL_FACE); LLGLDepthTest depth(GL_TRUE); - glMatrixMode(GL_PROJECTION); + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); - glLoadIdentity(); - glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f); + gGL.loadIdentity(); + gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); - glLoadIdentity(); + gGL.loadIdentity(); gGL.color4f(0.15f, 0.2f, 0.3f, 1.f); @@ -862,10 +862,10 @@ BOOL LLImagePreviewSculpted::render() gl_rect_2d_simple( mFullWidth, mFullHeight ); - glMatrixMode(GL_PROJECTION); + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.popMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.popMatrix(); glClear(GL_DEPTH_BUFFER_BIT); diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 6817f1e2c8..6412a573f5 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -4746,23 +4746,23 @@ BOOL LLModelPreview::render() { //clear background to blue - glMatrixMode(GL_PROJECTION); + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); - glLoadIdentity(); - glOrtho(0.0f, width, 0.0f, height, -1.0f, 1.0f); + gGL.loadIdentity(); + gGL.ortho(0.0f, width, 0.0f, height, -1.0f, 1.0f); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); - glLoadIdentity(); + gGL.loadIdentity(); gGL.color4f(0.169f, 0.169f, 0.169f, 1.f); gl_rect_2d_simple( width, height ); - glMatrixMode(GL_PROJECTION); + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.popMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.popMatrix(); } @@ -4872,7 +4872,7 @@ BOOL LLModelPreview::render() refresh(); } - glLoadIdentity(); + gGL.loadIdentity(); gPipeline.enableLightsPreview(); LLQuaternion camera_rot = LLQuaternion(mCameraPitch, LLVector3::y_axis) * @@ -4951,7 +4951,7 @@ BOOL LLModelPreview::render() gGL.pushMatrix(); LLMatrix4 mat = instance.mTransform; - glMultMatrixf((GLfloat*) mat.mMatrix); + gGL.multMatrix((GLfloat*) mat.mMatrix); for (U32 i = 0; i < mVertexBuffer[mPreviewLOD][model].size(); ++i) { @@ -5018,7 +5018,7 @@ BOOL LLModelPreview::render() gGL.pushMatrix(); LLMatrix4 mat = instance.mTransform; - glMultMatrixf((GLfloat*) mat.mMatrix); + gGL.multMatrix((GLfloat*) mat.mMatrix); bool render_mesh = true; @@ -5127,7 +5127,7 @@ BOOL LLModelPreview::render() gGL.pushMatrix(); LLMatrix4 mat = instance.mTransform; - glMultMatrixf((GLfloat*) mat.mMatrix); + gGL.multMatrix((GLfloat*) mat.mMatrix); LLPhysicsDecomp* decomp = gMeshRepo.mDecompThread; diff --git a/indra/newview/llfloaterpostcard.cpp b/indra/newview/llfloaterpostcard.cpp index 3bcbb987f7..2fd7c0ef0e 100644 --- a/indra/newview/llfloaterpostcard.cpp +++ b/indra/newview/llfloaterpostcard.cpp @@ -159,11 +159,11 @@ void LLFloaterPostcard::draw() } { - glMatrixMode(GL_TEXTURE); - glPushMatrix(); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.pushMatrix(); { - glScalef(mImageScale.mV[VX], mImageScale.mV[VY], 1.f); - glMatrixMode(GL_MODELVIEW); + gGL.scalef(mImageScale.mV[VX], mImageScale.mV[VY], 1.f); + gGL.matrixMode(LLRender::MM_MODELVIEW); gl_draw_scaled_image(rect.mLeft, rect.mBottom, rect.getWidth(), @@ -171,9 +171,9 @@ void LLFloaterPostcard::draw() mViewerImage.get(), LLColor4::white % alpha); } - glMatrixMode(GL_TEXTURE); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); } } } diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 00dc7b1627..a6678b9fee 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -445,9 +445,9 @@ void LLSnapshotLivePreview::draw() // calculate UV scale F32 uv_width = mImageScaled[mCurImageIndex] ? 1.f : llmin((F32)mWidth[mCurImageIndex] / (F32)mViewerImage[mCurImageIndex]->getWidth(), 1.f); F32 uv_height = mImageScaled[mCurImageIndex] ? 1.f : llmin((F32)mHeight[mCurImageIndex] / (F32)mViewerImage[mCurImageIndex]->getHeight(), 1.f); - glPushMatrix(); + gGL.pushMatrix(); { - glTranslatef((F32)rect.mLeft, (F32)rect.mBottom, 0.f); + gGL.translatef((F32)rect.mLeft, (F32)rect.mBottom, 0.f); gGL.begin(LLRender::QUADS); { gGL.texCoord2f(uv_width, uv_height); @@ -464,7 +464,7 @@ void LLSnapshotLivePreview::draw() } gGL.end(); } - glPopMatrix(); + gGL.popMatrix(); gGL.color4f(1.f, 1.f, 1.f, mFlashAlpha); gl_rect_2d(getRect()); @@ -580,11 +580,11 @@ void LLSnapshotLivePreview::draw() BOOL rescale = !mImageScaled[old_image_index] && mViewerImage[mCurImageIndex].notNull(); F32 uv_width = rescale ? llmin((F32)mWidth[old_image_index] / (F32)mViewerImage[mCurImageIndex]->getWidth(), 1.f) : 1.f; F32 uv_height = rescale ? llmin((F32)mHeight[old_image_index] / (F32)mViewerImage[mCurImageIndex]->getHeight(), 1.f) : 1.f; - glPushMatrix(); + gGL.pushMatrix(); { LLRect& rect = mImageRect[old_image_index]; - glTranslatef((F32)rect.mLeft, (F32)rect.mBottom - llround(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f); - glRotatef(-45.f * fall_interp, 0.f, 0.f, 1.f); + gGL.translatef((F32)rect.mLeft, (F32)rect.mBottom - llround(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f); + gGL.rotatef(-45.f * fall_interp, 0.f, 0.f, 1.f); gGL.begin(LLRender::QUADS); { gGL.texCoord2f(uv_width, uv_height); @@ -601,7 +601,7 @@ void LLSnapshotLivePreview::draw() } gGL.end(); } - glPopMatrix(); + gGL.popMatrix(); } } } @@ -2226,7 +2226,7 @@ void LLFloaterSnapshot::draw() S32 offset_x = (getRect().getWidth() - previewp->getThumbnailWidth()) / 2 ; S32 offset_y = thumbnail_rect.mBottom + (thumbnail_rect.getHeight() - previewp->getThumbnailHeight()) / 2 ; - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); // Apply floater transparency to the texture unless the floater is focused. F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); gl_draw_scaled_image(offset_x, offset_y, diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index fa3f546157..8c872283bd 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -115,7 +115,7 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) S32 center_y = (top + bottom) / 2; // save drawing mode - glMatrixMode(GL_PROJECTION); + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); BOOL limit_select_distance = gSavedSettings.getBOOL("LimitSelectDistance"); @@ -230,9 +230,9 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) } // restore drawing mode - glMatrixMode(GL_PROJECTION); + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.popMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); // restore camera LLViewerCamera::getInstance()->setFar(old_far_plane); diff --git a/indra/newview/llhudeffectbeam.cpp b/indra/newview/llhudeffectbeam.cpp index ec5a0926c4..8abad3d292 100644 --- a/indra/newview/llhudeffectbeam.cpp +++ b/indra/newview/llhudeffectbeam.cpp @@ -297,11 +297,11 @@ void LLHUDEffectBeam::render() coloru.mV[3] = (U8)alpha; gGL.color4ubv(coloru.mV); - glPushMatrix(); - glTranslatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]); - glScalef(scale, scale, scale); + gGL.pushMatrix(); + gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]); + gGL.scalef(scale, scale, scale); gSphere.render(); - glPopMatrix(); + gGL.popMatrix(); } } diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp index b380b3fe20..bc3b220dc0 100644 --- a/indra/newview/llhudeffectlookat.cpp +++ b/indra/newview/llhudeffectlookat.cpp @@ -498,10 +498,10 @@ void LLHUDEffectLookAt::render() gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLVector3 target = mTargetPos + ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->mHeadp->getWorldPosition(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); gGL.translatef(target.mV[VX], target.mV[VY], target.mV[VZ]); - glScalef(0.3f, 0.3f, 0.3f); + gGL.scalef(0.3f, 0.3f, 0.3f); gGL.begin(LLRender::LINES); { LLColor3 color = (*mAttentions)[mTargetType].mColor; diff --git a/indra/newview/llhudeffectpointat.cpp b/indra/newview/llhudeffectpointat.cpp index 28fe8e1c01..114a633821 100644 --- a/indra/newview/llhudeffectpointat.cpp +++ b/indra/newview/llhudeffectpointat.cpp @@ -327,7 +327,7 @@ void LLHUDEffectPointAt::render() LLVector3 target = mTargetPos + mSourceObject->getRenderPosition(); gGL.pushMatrix(); gGL.translatef(target.mV[VX], target.mV[VY], target.mV[VZ]); - glScalef(0.3f, 0.3f, 0.3f); + gGL.scalef(0.3f, 0.3f, 0.3f); gGL.begin(LLRender::LINES); { gGL.color3f(1.f, 0.f, 0.f); diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp index 1156e764a1..607f7f7f4b 100644 --- a/indra/newview/llhudrender.cpp +++ b/indra/newview/llhudrender.cpp @@ -112,9 +112,9 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, &winX, &winY, &winZ); //fonts all render orthographically, set up projection`` - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); LLUI::pushMatrix(); @@ -124,7 +124,7 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, winX -= world_view_rect.mLeft; winY -= world_view_rect.mBottom; LLUI::loadIdentity(); - glLoadIdentity(); + gGL.loadIdentity(); LLUI::translate((F32) winX*1.0f/LLFontGL::sScaleX, (F32) winY*1.0f/(LLFontGL::sScaleY), -(((F32) winZ*2.f)-1.f)); F32 right_x; @@ -133,7 +133,7 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent, LLUI::popMatrix(); gGL.popMatrix(); - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); } diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index d10f6562f7..6e0f360cbc 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -372,14 +372,14 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z) //LLVector3 center_agent = LLSelectMgr::getInstance()->getBBoxOfSelection().getCenterAgent(); LLVector3 center_agent = getPivotPoint(); - glPushMatrix(); + gGL.pushMatrix(); { - glTranslatef(center_agent.mV[VX], center_agent.mV[VY], center_agent.mV[VZ]); + gGL.translatef(center_agent.mV[VX], center_agent.mV[VY], center_agent.mV[VZ]); F32 angle_radians, x, y, z; grid_rot.getAngleAxis(&angle_radians, &x, &y, &z); - glRotatef(angle_radians * RAD_TO_DEG, x, y, z); + gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z); F32 region_size = LLWorld::getInstance()->getRegionWidthInMeters(); @@ -416,7 +416,7 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z) } LLUI::setLineWidth(1.0f); } - glPopMatrix(); + gGL.popMatrix(); } void LLManip::renderXYZ(const LLVector3 &vec) @@ -481,8 +481,8 @@ void LLManip::renderTickText(const LLVector3& pos, const std::string& text, cons const LLFontGL* big_fontp = LLFontGL::getFontSansSerif(); BOOL hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD; - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); LLVector3 render_pos = pos; if (hud_selection) { @@ -490,7 +490,7 @@ void LLManip::renderTickText(const LLVector3& pos, const std::string& text, cons F32 inv_zoom_amt = 1.f / zoom_amt; // scale text back up to counter-act zoom level render_pos = pos * zoom_amt; - glScalef(inv_zoom_amt, inv_zoom_amt, inv_zoom_amt); + gGL.scalef(inv_zoom_amt, inv_zoom_amt, inv_zoom_amt); } // render shadow first @@ -501,7 +501,7 @@ void LLManip::renderTickText(const LLVector3& pos, const std::string& text, cons gViewerWindow->setup3DViewport(); hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(text), 3.f, color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD); - glPopMatrix(); + gGL.popMatrix(); } void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string& suffix, const LLColor4 &color) @@ -539,8 +539,8 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string } BOOL hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD; - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); LLVector3 render_pos = pos; if (hud_selection) { @@ -548,7 +548,7 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string F32 inv_zoom_amt = 1.f / zoom_amt; // scale text back up to counter-act zoom level render_pos = pos * zoom_amt; - glScalef(inv_zoom_amt, inv_zoom_amt, inv_zoom_amt); + gGL.scalef(inv_zoom_amt, inv_zoom_amt, inv_zoom_amt); } LLColor4 shadow_color = LLColor4::black; @@ -573,7 +573,7 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string gViewerWindow->setup3DViewport(); hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(val_string), 3.f, color, hud_selection); } - glPopMatrix(); + gGL.popMatrix(); } LLColor4 LLManip::setupSnapGuideRenderPass(S32 pass) diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 6ee095475f..19798ef752 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -130,12 +130,12 @@ void LLManipRotate::render() return; } - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { F32 zoom = gAgentCamera.mHUDCurZoom; - glScalef(zoom, zoom, zoom); + gGL.scalef(zoom, zoom, zoom); } @@ -145,7 +145,7 @@ void LLManipRotate::render() LLColor4 highlight_inside( 0.7f, 0.7f, 0.f, 0.5f ); F32 width_meters = WIDTH_PIXELS * mRadiusMeters / RADIUS_PIXELS; - glPushMatrix(); + gGL.pushMatrix(); { // are we in the middle of a constrained drag? if (mManipPart >= LL_ROT_X && mManipPart <= LL_ROT_Z) @@ -156,11 +156,11 @@ void LLManipRotate::render() { LLGLEnable cull_face(GL_CULL_FACE); LLGLDepthTest gls_depth(GL_FALSE); - glPushMatrix(); + gGL.pushMatrix(); { // Draw "sphere" (intersection of sphere with tangent cone that has apex at camera) - glTranslatef( mCenterToProfilePlane.mV[VX], mCenterToProfilePlane.mV[VY], mCenterToProfilePlane.mV[VZ] ); - glTranslatef( center.mV[VX], center.mV[VY], center.mV[VZ] ); + gGL.translatef( mCenterToProfilePlane.mV[VX], mCenterToProfilePlane.mV[VY], mCenterToProfilePlane.mV[VZ] ); + gGL.translatef( center.mV[VX], center.mV[VY], center.mV[VZ] ); // Inverse change of basis vectors LLVector3 forward = mCenterToCamNorm; @@ -177,14 +177,14 @@ void LLManipRotate::render() LLMatrix4 mat; mat.initRows(a, b, c, LLVector4(0.f, 0.f, 0.f, 1.f)); - glMultMatrixf( &mat.mMatrix[0][0] ); + gGL.multMatrix( &mat.mMatrix[0][0] ); - glRotatef( -90, 0.f, 1.f, 0.f); + gGL.rotatef( -90, 0.f, 1.f, 0.f); LLColor4 color; if (mManipPart == LL_ROT_ROLL || mHighlightedPart == LL_ROT_ROLL) { color.setVec(0.8f, 0.8f, 0.8f, 0.8f); - glScalef(mManipulatorScales.mV[VW], mManipulatorScales.mV[VW], mManipulatorScales.mV[VW]); + gGL.scalef(mManipulatorScales.mV[VW], mManipulatorScales.mV[VW], mManipulatorScales.mV[VW]); } else { @@ -202,10 +202,10 @@ void LLManipRotate::render() GLdouble plane_eqn[] = { 0, 0, 1, 0 }; glClipPlane( GL_CLIP_PLANE0, plane_eqn ); } - glPopMatrix(); + gGL.popMatrix(); } - glTranslatef( center.mV[VX], center.mV[VY], center.mV[VZ] ); + gGL.translatef( center.mV[VX], center.mV[VY], center.mV[VZ] ); LLQuaternion rot; F32 angle_radians, x, y, z; @@ -217,41 +217,41 @@ void LLManipRotate::render() LLSelectMgr::getInstance()->getGrid(grid_origin, grid_rotation, grid_scale); grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z); - glRotatef(angle_radians * RAD_TO_DEG, x, y, z); + gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z); if (mManipPart == LL_ROT_Z) { mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); - glPushMatrix(); + gGL.pushMatrix(); { // selected part - glScalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]); + gGL.scalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]); renderActiveRing( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 1.f, 1.f) , LLColor4( 0.f, 0.f, 1.f, 0.3f )); } - glPopMatrix(); + gGL.popMatrix(); } else if (mManipPart == LL_ROT_Y) { mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); - glPushMatrix(); + gGL.pushMatrix(); { - glRotatef( 90.f, 1.f, 0.f, 0.f ); - glScalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]); + gGL.rotatef( 90.f, 1.f, 0.f, 0.f ); + gGL.scalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]); renderActiveRing( mRadiusMeters, width_meters, LLColor4( 0.f, 1.f, 0.f, 1.f), LLColor4( 0.f, 1.f, 0.f, 0.3f)); } - glPopMatrix(); + gGL.popMatrix(); } else if (mManipPart == LL_ROT_X) { mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); - glPushMatrix(); + gGL.pushMatrix(); { - glRotatef( 90.f, 0.f, 1.f, 0.f ); - glScalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]); + gGL.rotatef( 90.f, 0.f, 1.f, 0.f ); + gGL.scalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]); renderActiveRing( mRadiusMeters, width_meters, LLColor4( 1.f, 0.f, 0.f, 1.f), LLColor4( 1.f, 0.f, 0.f, 0.3f)); } - glPopMatrix(); + gGL.popMatrix(); } else if (mManipPart == LL_ROT_ROLL) { @@ -271,12 +271,12 @@ void LLManipRotate::render() // First pass: centers. Second pass: sides. for( S32 i=0; i<2; i++ ) { - glPushMatrix(); + gGL.pushMatrix(); { if (mHighlightedPart == LL_ROT_Z) { mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, 1.f, SELECTED_MANIPULATOR_SCALE, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); - glScalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]); + gGL.scalef(mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ], mManipulatorScales.mV[VZ]); // hovering over part gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 1.f, 1.f ), LLColor4( 0.f, 0.f, 1.f, 0.5f ), CIRCLE_STEPS, i); } @@ -286,15 +286,15 @@ void LLManipRotate::render() gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.f, 0.8f, 0.8f ), LLColor4( 0.f, 0.f, 0.8f, 0.4f ), CIRCLE_STEPS, i); } } - glPopMatrix(); + gGL.popMatrix(); - glPushMatrix(); + gGL.pushMatrix(); { - glRotatef( 90.f, 1.f, 0.f, 0.f ); + gGL.rotatef( 90.f, 1.f, 0.f, 0.f ); if (mHighlightedPart == LL_ROT_Y) { mManipulatorScales = lerp(mManipulatorScales, LLVector4(1.f, SELECTED_MANIPULATOR_SCALE, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); - glScalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]); + gGL.scalef(mManipulatorScales.mV[VY], mManipulatorScales.mV[VY], mManipulatorScales.mV[VY]); // hovering over part gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 1.f, 0.f, 1.f ), LLColor4( 0.f, 1.f, 0.f, 0.5f ), CIRCLE_STEPS, i); } @@ -304,15 +304,15 @@ void LLManipRotate::render() gl_ring( mRadiusMeters, width_meters, LLColor4( 0.f, 0.8f, 0.f, 0.8f ), LLColor4( 0.f, 0.8f, 0.f, 0.4f ), CIRCLE_STEPS, i); } } - glPopMatrix(); + gGL.popMatrix(); - glPushMatrix(); + gGL.pushMatrix(); { - glRotatef( 90.f, 0.f, 1.f, 0.f ); + gGL.rotatef( 90.f, 0.f, 1.f, 0.f ); if (mHighlightedPart == LL_ROT_X) { mManipulatorScales = lerp(mManipulatorScales, LLVector4(SELECTED_MANIPULATOR_SCALE, 1.f, 1.f, 1.f), LLCriticalDamp::getInterpolant(MANIPULATOR_SCALE_HALF_LIFE)); - glScalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]); + gGL.scalef(mManipulatorScales.mV[VX], mManipulatorScales.mV[VX], mManipulatorScales.mV[VX]); // hovering over part gl_ring( mRadiusMeters, width_meters, LLColor4( 1.f, 0.f, 0.f, 1.f ), LLColor4( 1.f, 0.f, 0.f, 0.5f ), CIRCLE_STEPS, i); @@ -323,7 +323,7 @@ void LLManipRotate::render() gl_ring( mRadiusMeters, width_meters, LLColor4( 0.8f, 0.f, 0.f, 0.8f ), LLColor4( 0.8f, 0.f, 0.f, 0.4f ), CIRCLE_STEPS, i); } } - glPopMatrix(); + gGL.popMatrix(); if (mHighlightedPart == LL_ROT_ROLL) { @@ -332,8 +332,8 @@ void LLManipRotate::render() } } } - glPopMatrix(); - glPopMatrix(); + gGL.popMatrix(); + gGL.popMatrix(); LLVector3 euler_angles; LLQuaternion object_rot = first_object->getRotationEdit(); @@ -796,14 +796,14 @@ void LLManipRotate::renderSnapGuides() for (S32 pass = 0; pass < 3; pass++) { // render snap guide ring - glPushMatrix(); + gGL.pushMatrix(); LLQuaternion snap_guide_rot; F32 angle_radians, x, y, z; snap_guide_rot.shortestArc(LLVector3::z_axis, getConstraintAxis()); snap_guide_rot.getAngleAxis(&angle_radians, &x, &y, &z); - glTranslatef(center.mV[VX], center.mV[VY], center.mV[VZ]); - glRotatef(angle_radians * RAD_TO_DEG, x, y, z); + gGL.translatef(center.mV[VX], center.mV[VY], center.mV[VZ]); + gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z); LLColor4 line_color = setupSnapGuideRenderPass(pass); @@ -826,7 +826,7 @@ void LLManipRotate::renderSnapGuides() { gl_circle_2d(0.f, 0.f, mRadiusMeters * SNAP_GUIDE_INNER_RADIUS, CIRCLE_STEPS, FALSE); } - glPopMatrix(); + gGL.popMatrix(); for (S32 i = 0; i < 64; i++) { diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index 4eb94dfb8e..f6df4cdfbf 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -217,12 +217,12 @@ void LLManipScale::render() if( canAffectSelection() ) { - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { F32 zoom = gAgentCamera.mHUDCurZoom; - glScalef(zoom, zoom, zoom); + gGL.scalef(zoom, zoom, zoom); } //////////////////////////////////////////////////////////////////////// @@ -274,14 +274,14 @@ void LLManipScale::render() LLVector3 pos_agent = bbox.getPositionAgent(); LLQuaternion rot = bbox.getRotation(); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); { - glTranslatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ]); + gGL.translatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ]); F32 angle_radians, x, y, z; rot.getAngleAxis(&angle_radians, &x, &y, &z); - glRotatef(angle_radians * RAD_TO_DEG, x, y, z); + gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z); { @@ -303,13 +303,13 @@ void LLManipScale::render() glPolygonOffset( 0.f, 0.f); } } - glPopMatrix(); + gGL.popMatrix(); if (mManipPart != LL_NO_PART) { renderSnapGuides(bbox); } - glPopMatrix(); + gGL.popMatrix(); renderXYZ(bbox.getExtentLocal()); } @@ -719,17 +719,17 @@ void LLManipScale::renderEdges( const LLBBox& bbox ) LLVector3 direction = edgeToUnitVector( part ); LLVector3 center_to_edge = unitVectorToLocalBBoxExtent( direction, bbox ); - glPushMatrix(); + gGL.pushMatrix(); { - glTranslatef( center_to_edge.mV[0], center_to_edge.mV[1], center_to_edge.mV[2] ); + gGL.translatef( center_to_edge.mV[0], center_to_edge.mV[1], center_to_edge.mV[2] ); conditionalHighlight( part ); - glScalef( + gGL.scalef( direction.mV[0] ? edge_width : extent.mV[VX], direction.mV[1] ? edge_width : extent.mV[VY], direction.mV[2] ? edge_width : extent.mV[VZ] ); gBox.render(); } - glPopMatrix(); + gGL.popMatrix(); } } @@ -766,13 +766,13 @@ void LLManipScale::renderBoxHandle( F32 x, F32 y, F32 z ) gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest gls_depth(GL_FALSE); - glPushMatrix(); + gGL.pushMatrix(); { - glTranslatef( x, y, z ); - glScalef( mScaledBoxHandleSize, mScaledBoxHandleSize, mScaledBoxHandleSize ); + gGL.translatef( x, y, z ); + gGL.scalef( mScaledBoxHandleSize, mScaledBoxHandleSize, mScaledBoxHandleSize ); gBox.render(); } - glPopMatrix(); + gGL.popMatrix(); } @@ -788,16 +788,16 @@ void LLManipScale::renderAxisHandle( const LLVector3& start, const LLVector3& en LLVector3 delta = end - offset_start; LLVector3 pos = offset_start + 0.5f * delta; - glPushMatrix(); + gGL.pushMatrix(); { - glTranslatef( pos.mV[VX], pos.mV[VY], pos.mV[VZ] ); - glScalef( + gGL.translatef( pos.mV[VX], pos.mV[VY], pos.mV[VZ] ); + gGL.scalef( mBoxHandleSize + llabs(delta.mV[VX]), mBoxHandleSize + llabs(delta.mV[VY]), mBoxHandleSize + llabs(delta.mV[VZ])); gBox.render(); } - glPopMatrix(); + gGL.popMatrix(); } else { diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index a9b14829b2..3a88fbd96d 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -1066,12 +1066,12 @@ BOOL LLManipTranslate::handleMouseUp(S32 x, S32 y, MASK mask) void LLManipTranslate::render() { - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD) { F32 zoom = gAgentCamera.mHUDCurZoom; - glScalef(zoom, zoom, zoom); + gGL.scalef(zoom, zoom, zoom); } { LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); @@ -1515,12 +1515,12 @@ void LLManipTranslate::renderSnapGuides() F32 x,y,z,angle_radians; grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z); gGL.translatef(selection_center.mV[VX], selection_center.mV[VY], selection_center.mV[VZ]); - glRotatef(angle_radians * RAD_TO_DEG, x, y, z); + gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z); F32 sz = mGridSizeMeters; F32 tiles = sz; - glMatrixMode(GL_TEXTURE); + gGL.matrixMode(LLRender::MM_TEXTURE); gGL.pushMatrix(); usc = 1.0f/usc; vsc = 1.0f/vsc; @@ -1534,7 +1534,7 @@ void LLManipTranslate::renderSnapGuides() vsc *= 0.5f; } - glScalef(usc, vsc, 1.0f); + gGL.scalef(usc, vsc, 1.0f); gGL.translatef(u, v, 0); float a = line_alpha; @@ -1567,7 +1567,7 @@ void LLManipTranslate::renderSnapGuides() renderGrid(u,v,tiles,1,1,1,a); gGL.popMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.popMatrix(); } @@ -1724,7 +1724,7 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal, F32 x,y,z,angle_radians; grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z); gGL.translatef(selection_center.mV[VX], selection_center.mV[VY], selection_center.mV[VZ]); - glRotatef(angle_radians * RAD_TO_DEG, x, y, z); + gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z); F32 sz = mGridSizeMeters; F32 tiles = sz; @@ -1853,7 +1853,7 @@ void LLManipTranslate::renderTranslationHandles() mGridSizeMeters = gSavedSettings.getF32("GridDrawSize"); mConeSize = mArrowLengthMeters / 4.f; - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); { gGL.translatef(selection_center.mV[VX], selection_center.mV[VY], selection_center.mV[VZ]); @@ -1861,7 +1861,7 @@ void LLManipTranslate::renderTranslationHandles() F32 angle_radians, x, y, z; grid_rotation.getAngleAxis(&angle_radians, &x, &y, &z); - glRotatef(angle_radians * RAD_TO_DEG, x, y, z); + gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z); LLQuaternion invRotation = grid_rotation; invRotation.conjQuat(); @@ -1909,9 +1909,9 @@ void LLManipTranslate::renderTranslationHandles() { // render YZ plane manipulator gGL.pushMatrix(); - glScalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]); + gGL.scalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]); gGL.translatef(0.f, mPlaneManipOffsetMeters, mPlaneManipOffsetMeters); - glScalef(mPlaneScales.mV[VX], mPlaneScales.mV[VX], mPlaneScales.mV[VX]); + gGL.scalef(mPlaneScales.mV[VX], mPlaneScales.mV[VX], mPlaneScales.mV[VX]); if (mHighlightedPart == LL_YZ_PLANE) { color1.setVec(0.f, 1.f, 0.f, 1.f); @@ -1963,9 +1963,9 @@ void LLManipTranslate::renderTranslationHandles() { // render XZ plane manipulator gGL.pushMatrix(); - glScalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]); + gGL.scalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]); gGL.translatef(mPlaneManipOffsetMeters, 0.f, mPlaneManipOffsetMeters); - glScalef(mPlaneScales.mV[VY], mPlaneScales.mV[VY], mPlaneScales.mV[VY]); + gGL.scalef(mPlaneScales.mV[VY], mPlaneScales.mV[VY], mPlaneScales.mV[VY]); if (mHighlightedPart == LL_XZ_PLANE) { color1.setVec(0.f, 0.f, 1.f, 1.f); @@ -2019,7 +2019,7 @@ void LLManipTranslate::renderTranslationHandles() { // render XY plane manipulator gGL.pushMatrix(); - glScalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]); + gGL.scalef(mPlaneManipPositions.mV[VX], mPlaneManipPositions.mV[VY], mPlaneManipPositions.mV[VZ]); /* Y ^ @@ -2044,7 +2044,7 @@ void LLManipTranslate::renderTranslationHandles() v2 = LLVector3(mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), 0.f); v3 = LLVector3(mPlaneManipOffsetMeters * (-PLANE_TICK_SIZE * 0.75f), mPlaneManipOffsetMeters * ( PLANE_TICK_SIZE * 0.25f), 0.f); #endif - glScalef(mPlaneScales.mV[VZ], mPlaneScales.mV[VZ], mPlaneScales.mV[VZ]); + gGL.scalef(mPlaneScales.mV[VZ], mPlaneScales.mV[VZ], mPlaneScales.mV[VZ]); if (mHighlightedPart == LL_XY_PLANE) { color1.setVec(1.f, 0.f, 0.f, 1.f); @@ -2216,7 +2216,7 @@ void LLManipTranslate::renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_ } gGL.translatef(vec.mV[0], vec.mV[1], vec.mV[2]); - glScalef(handle_size, handle_size, handle_size); + gGL.scalef(handle_size, handle_size, handle_size); F32 rot = 0.0f; LLVector3 axis; @@ -2241,8 +2241,8 @@ void LLManipTranslate::renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_ } gGL.diffuseColor4fv(color.mV); - glRotatef(rot, axis.mV[0], axis.mV[1], axis.mV[2]); - glScalef(mArrowScales.mV[index], mArrowScales.mV[index], mArrowScales.mV[index] * 1.5f); + gGL.rotatef(rot, axis.mV[0], axis.mV[1], axis.mV[2]); + gGL.scalef(mArrowScales.mV[index], mArrowScales.mV[index], mArrowScales.mV[index] * 1.5f); gCone.render(); diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 5fe5c9b1e8..15d5d7c162 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -172,10 +172,10 @@ void LLNetMap::draw() LLVector3 offset = gGL.getUITranslation(); LLVector3 scale = gGL.getUIScale(); - glLoadIdentity(); + gGL.loadIdentity(); gGL.loadUIIdentity(); - glScalef(scale.mV[0], scale.mV[1], scale.mV[2]); + gGL.scalef(scale.mV[0], scale.mV[1], scale.mV[2]); gGL.translatef(offset.mV[0], offset.mV[1], offset.mV[2]); { @@ -183,7 +183,7 @@ void LLNetMap::draw() { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); // Draw background rectangle LLColor4 background_color = mBackgroundColor.get(); @@ -204,7 +204,7 @@ void LLNetMap::draw() { // rotate subsequent draws to agent rotation rotation = atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ); - glRotatef( rotation * RAD_TO_DEG, 0.f, 0.f, 1.f); + gGL.rotatef( rotation * RAD_TO_DEG, 0.f, 0.f, 1.f); } // figure out where agent is @@ -492,7 +492,7 @@ void LLNetMap::draw() // If we don't rotate the map, we have to rotate the frustum. gGL.pushMatrix(); gGL.translatef( ctr_x, ctr_y, 0 ); - glRotatef( atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ) * RAD_TO_DEG, 0.f, 0.f, -1.f); + gGL.rotatef( atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ) * RAD_TO_DEG, 0.f, 0.f, -1.f); gGL.begin( LLRender::TRIANGLES ); gGL.vertex2f( 0, 0 ); gGL.vertex2f( -half_width_pixels, far_clip_pixels ); diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index db7d836799..a637ff156c 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -287,15 +287,15 @@ LLPanelLogin::~LLPanelLogin() // virtual void LLPanelLogin::draw() { - glPushMatrix(); + gGL.pushMatrix(); { F32 image_aspect = 1.333333f; F32 view_aspect = (F32)getRect().getWidth() / (F32)getRect().getHeight(); // stretch image to maintain aspect ratio if (image_aspect > view_aspect) { - glTranslatef(-0.5f * (image_aspect / view_aspect - 1.f) * getRect().getWidth(), 0.f, 0.f); - glScalef(image_aspect / view_aspect, 1.f, 1.f); + gGL.translatef(-0.5f * (image_aspect / view_aspect - 1.f) * getRect().getWidth(), 0.f, 0.f); + gGL.scalef(image_aspect / view_aspect, 1.f, 1.f); } S32 width = getRect().getWidth(); @@ -310,7 +310,7 @@ void LLPanelLogin::draw() mLogoImage->draw(0, -264, width + 8, mLogoImage->getHeight()); }; } - glPopMatrix(); + gGL.popMatrix(); LLPanel::draw(); } diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp index a1f38f1854..5d7a5b1c59 100644 --- a/indra/newview/llprogressview.cpp +++ b/indra/newview/llprogressview.cpp @@ -187,7 +187,7 @@ void LLProgressView::setVisible(BOOL visible) void LLProgressView::drawStartTexture(F32 alpha) { - glPushMatrix(); + gGL.pushMatrix(); if (gStartTexture) { LLGLSUIDefault gls_ui; @@ -200,13 +200,13 @@ void LLProgressView::drawStartTexture(F32 alpha) // stretch image to maintain aspect ratio if (image_aspect > view_aspect) { - glTranslatef(-0.5f * (image_aspect / view_aspect - 1.f) * width, 0.f, 0.f); - glScalef(image_aspect / view_aspect, 1.f, 1.f); + gGL.translatef(-0.5f * (image_aspect / view_aspect - 1.f) * width, 0.f, 0.f); + gGL.scalef(image_aspect / view_aspect, 1.f, 1.f); } else { - glTranslatef(0.f, -0.5f * (view_aspect / image_aspect - 1.f) * height, 0.f); - glScalef(1.f, view_aspect / image_aspect, 1.f); + gGL.translatef(0.f, -0.5f * (view_aspect / image_aspect - 1.f) * height, 0.f); + gGL.scalef(1.f, view_aspect / image_aspect, 1.f); } gl_rect_2d_simple_tex( getRect().getWidth(), getRect().getHeight() ); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); @@ -217,7 +217,7 @@ void LLProgressView::drawStartTexture(F32 alpha) gGL.color4f(0.f, 0.f, 0.f, 1.f); gl_rect_2d(getRect()); } - glPopMatrix(); + gGL.popMatrix(); } diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 48cccc12ef..76d6954a88 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -5134,20 +5134,20 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) F32 cur_zoom = gAgentCamera.mHUDCurZoom; // set up transform to encompass bounding box of HUD - glMatrixMode(GL_PROJECTION); + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); - glLoadIdentity(); + gGL.loadIdentity(); F32 depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f); - glOrtho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth); + gGL.ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); gGL.pushUIMatrix(); gGL.loadUIIdentity(); - glLoadIdentity(); - glLoadMatrixf(OGL_TO_CFR_ROTATION); // Load Cory's favorite reference frame - glTranslatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f); - glScalef(cur_zoom, cur_zoom, cur_zoom); + gGL.loadIdentity(); + gGL.loadMatrix(OGL_TO_CFR_ROTATION); // Load Cory's favorite reference frame + gGL.translatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f); + gGL.scalef(cur_zoom, cur_zoom, cur_zoom); } if (mSelectedObjects->getNumNodes()) { @@ -5240,10 +5240,10 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) if (isAgentAvatarValid() && for_hud) { - glMatrixMode(GL_PROJECTION); + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.popMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.popMatrix(); gGL.popUIMatrix(); stop_glerror(); @@ -5567,7 +5567,7 @@ void pushWireframe(LLDrawable* drawable) { LLVertexBuffer::unbind(); gGL.pushMatrix(); - glMultMatrixf((F32*) vobj->getRelativeXform().mMatrix); + gGL.multMatrix((F32*) vobj->getRelativeXform().mMatrix); for (S32 i = 0; i < rigged_volume->getNumVolumeFaces(); ++i) { const LLVolumeFace& face = rigged_volume->getVolumeFace(i); @@ -5611,22 +5611,22 @@ void LLSelectNode::renderOneWireframe(const LLColor4& color) gHighlightProgram.bind(); } - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); BOOL is_hud_object = objectp->isHUDAttachment(); if (drawable->isActive()) { - glLoadMatrixd(gGLModelView); - glMultMatrixf((F32*) objectp->getRenderMatrix().mMatrix); + gGL.loadMatrix(gGLModelView); + gGL.multMatrix((F32*) objectp->getRenderMatrix().mMatrix); } else if (!is_hud_object) { - glLoadIdentity(); - glMultMatrixd(gGLModelView); + gGL.loadIdentity(); + gGL.multMatrix(gGLModelView); LLVector3 trans = objectp->getRegion()->getOriginAgent(); - glTranslatef(trans.mV[0], trans.mV[1], trans.mV[2]); + gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]); } glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); @@ -5713,21 +5713,21 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) return; } - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); gGL.pushUIMatrix(); gGL.loadUIIdentity(); if (!is_hud_object) { - glLoadIdentity(); - glMultMatrixd(gGLModelView); + gGL.loadIdentity(); + gGL.multMatrix(gGLModelView); } if (drawable->isActive()) { - glMultMatrixf((F32*) objectp->getRenderMatrix().mMatrix); + gGL.multMatrix((F32*) objectp->getRenderMatrix().mMatrix); } LLVolume *volume = objectp->getVolume(); diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index e0c3b43110..81d7fe70c1 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2552,9 +2552,9 @@ void renderOctree(LLSpatialGroup* group) LLDrawable* drawable = *i; if (!group->mSpatialPartition->isBridge()) { - glPushMatrix(); + gGL.pushMatrix(); LLVector3 trans = drawable->getRegion()->getOriginAgent(); - glTranslatef(trans.mV[0], trans.mV[1], trans.mV[2]); + gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]); } for (S32 j = 0; j < drawable->getNumFaces(); j++) @@ -2584,7 +2584,7 @@ void renderOctree(LLSpatialGroup* group) if (!group->mSpatialPartition->isBridge()) { - glPopMatrix(); + gGL.popMatrix(); } } glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); @@ -2866,7 +2866,7 @@ void renderNormals(LLDrawable* drawablep) { LLVolume* volume = vol->getVolume(); gGL.pushMatrix(); - glMultMatrixf((F32*) vol->getRelativeXform().mMatrix); + gGL.multMatrix((F32*) vol->getRelativeXform().mMatrix); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); @@ -3018,7 +3018,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) LLVector3 size(0.25f,0.25f,0.25f); gGL.pushMatrix(); - glMultMatrixf((F32*) volume->getRelativeXform().mMatrix); + gGL.multMatrix((F32*) volume->getRelativeXform().mMatrix); if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::USER_MESH) { @@ -3264,6 +3264,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) LLVertexBuffer::unbind(); glVertexPointer(3, GL_FLOAT, 16, phys_volume->mHullPoints); gGL.diffuseColor4fv(line_color.mV); + gGL.syncMatrices(); glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices); gGL.diffuseColor4fv(color.mV); @@ -3302,7 +3303,7 @@ void renderPhysicsShapes(LLSpatialGroup* group) { gGL.pushMatrix(); LLVector3 trans = drawable->getRegion()->getOriginAgent(); - glTranslatef(trans.mV[0], trans.mV[1], trans.mV[2]); + gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]); renderPhysicsShape(drawable, volume); gGL.popMatrix(); } @@ -3618,8 +3619,8 @@ void renderRaycast(LLDrawable* drawablep) } gGL.pushMatrix(); - glTranslatef(trans.mV[0], trans.mV[1], trans.mV[2]); - glMultMatrixf((F32*) vobj->getRelativeXform().mMatrix); + gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]); + gGL.multMatrix((F32*) vobj->getRelativeXform().mMatrix); LLVector3 start, end; if (transform) @@ -3650,6 +3651,7 @@ void renderRaycast(LLDrawable* drawablep) LLVertexBuffer::unbind(); gGL.diffuseColor4f(0,1,1,0.5f); glVertexPointer(3, GL_FLOAT, sizeof(LLVector4a), face.mPositions); + gGL.syncMatrices(); glDrawElements(GL_TRIANGLES, face.mNumIndices, GL_UNSIGNED_SHORT, face.mIndices); } @@ -3672,15 +3674,15 @@ void renderRaycast(LLDrawable* drawablep) if (drawablep->getVObj() == gDebugRaycastObject) { // draw intersection point - glPushMatrix(); - glLoadMatrixd(gGLModelView); + gGL.pushMatrix(); + gGL.loadMatrix(gGLModelView); LLVector3 translate = gDebugRaycastIntersection; - glTranslatef(translate.mV[0], translate.mV[1], translate.mV[2]); + gGL.translatef(translate.mV[0], translate.mV[1], translate.mV[2]); LLCoordFrame orient; orient.lookDir(gDebugRaycastNormal, gDebugRaycastBinormal); LLMatrix4 rotation; orient.getRotMatrixToParent(rotation); - glMultMatrixf((float*)rotation.mMatrix); + gGL.multMatrix((float*)rotation.mMatrix); gGL.color4f(1,0,0,0.5f); drawBox(LLVector3(0, 0, 0), LLVector3(0.1f, 0.022f, 0.022f)); @@ -3688,7 +3690,7 @@ void renderRaycast(LLDrawable* drawablep) drawBox(LLVector3(0, 0, 0), LLVector3(0.021f, 0.1f, 0.021f)); gGL.color4f(0,0,1,0.5f); drawBox(LLVector3(0, 0, 0), LLVector3(0.02f, 0.02f, 0.1f)); - glPopMatrix(); + gGL.popMatrix(); // draw bounding box of prim const LLVector4a* ext = drawablep->getSpatialExtents(); @@ -3763,13 +3765,13 @@ public: group->rebuildMesh(); gGL.flush(); - glPushMatrix(); + gGL.pushMatrix(); gGLLastMatrix = NULL; - glLoadMatrixd(gGLModelView); + gGL.loadMatrix(gGLModelView); renderVisibility(group, mCamera); stop_glerror(); gGLLastMatrix = NULL; - glPopMatrix(); + gGL.popMatrix(); gGL.color4f(1,1,1,1); } } diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index f44e62335d..e2c2b2ae21 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -216,22 +216,22 @@ void LLTexLayerSetBuffer::cancelUpload() void LLTexLayerSetBuffer::pushProjection() const { - glMatrixMode(GL_PROJECTION); + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); - glLoadIdentity(); - glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f); + gGL.loadIdentity(); + gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); - glLoadIdentity(); + gGL.loadIdentity(); } void LLTexLayerSetBuffer::popProjection() const { - glMatrixMode(GL_PROJECTION); + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.popMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.popMatrix(); } diff --git a/indra/newview/lltoolbrush.cpp b/indra/newview/lltoolbrush.cpp index 9782b90cf1..aba43a9715 100644 --- a/indra/newview/lltoolbrush.cpp +++ b/indra/newview/lltoolbrush.cpp @@ -507,12 +507,12 @@ void LLToolBrushLand::render() void LLToolBrushLand::renderOverlay(LLSurface& land, const LLVector3& pos_region, const LLVector3& pos_world) { - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest mDepthTest(GL_TRUE); - glPushMatrix(); + gGL.pushMatrix(); gGL.color4fv(OVERLAY_COLOR.mV); - glTranslatef(0.0f, 0.0f, 1.0f); + gGL.translatef(0.0f, 0.0f, 1.0f); S32 i = (S32) pos_region.mV[VX]; S32 j = (S32) pos_region.mV[VY]; @@ -566,7 +566,7 @@ void LLToolBrushLand::renderOverlay(LLSurface& land, const LLVector3& pos_region } gGL.end(); - glPopMatrix(); + gGL.popMatrix(); } void LLToolBrushLand::determineAffectedRegions(region_list_t& regions, diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp index eeb90a2b19..718201e381 100644 --- a/indra/newview/lltoolmorph.cpp +++ b/indra/newview/lltoolmorph.cpp @@ -169,14 +169,14 @@ BOOL LLVisualParamHint::render() gGL.pushUIMatrix(); gGL.loadUIIdentity(); - glMatrixMode(GL_PROJECTION); + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); - glLoadIdentity(); - glOrtho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f); + gGL.loadIdentity(); + gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); - glLoadIdentity(); + gGL.loadIdentity(); if (LLGLSLShader::sNoFixedFunction) { @@ -187,10 +187,10 @@ BOOL LLVisualParamHint::render() //LLGLState::verify(TRUE); mBackgroundp->draw(0, 0, mFullWidth, mFullHeight); - glMatrixMode(GL_PROJECTION); + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.popMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.popMatrix(); mNeedsUpdate = FALSE; diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp index 2ec7534025..bec05bd3d2 100644 --- a/indra/newview/lltracker.cpp +++ b/indra/newview/lltracker.cpp @@ -505,10 +505,10 @@ void LLTracker::renderBeacon(LLVector3d pos_global, LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); { - glTranslatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]); + gGL.translatef(pos_agent.mV[0], pos_agent.mV[1], pos_agent.mV[2]); draw_shockwave(1024.f, gRenderStartTime.getElapsedTimeF32(), 32, fogged_color); diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index 7f7366dd3d..c0ef4da1ff 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -325,8 +325,8 @@ void LLViewerCamera::setPerspective(BOOL for_selection, aspect = getAspect(); // Load camera view matrix - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.loadIdentity(); glh::matrix4f proj_mat; @@ -385,14 +385,14 @@ void LLViewerCamera::setPerspective(BOOL for_selection, proj_mat *= gl_perspective(fov_y,aspect,z_near,z_far); - glLoadMatrixf(proj_mat.m); + gGL.loadMatrix(proj_mat.m); for (U32 i = 0; i < 16; i++) { gGLProjection[i] = proj_mat.m[i]; } - glMatrixMode( GL_MODELVIEW ); + gGL.matrixMode(LLRender::MM_MODELVIEW); glh::matrix4f modelview((GLfloat*) OGL_TO_CFR_ROTATION); @@ -402,7 +402,7 @@ void LLViewerCamera::setPerspective(BOOL for_selection, modelview *= glh::matrix4f(ogl_matrix); - glLoadMatrixf(modelview.m); + gGL.loadMatrix(modelview.m); if (for_selection && (width > 1 || height > 1)) { @@ -431,10 +431,10 @@ void LLViewerCamera::setPerspective(BOOL for_selection, /*if (gSavedSettings.getBOOL("CameraOffset")) { - glMatrixMode(GL_PROJECTION); - glTranslatef(0,0,-50); - glRotatef(20.0,1,0,0); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.translatef(0,0,-50); + gGL.rotatef(20.0,1,0,0); + gGL.matrixMode(LLRender::MM_MODELVIEW); }*/ } diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index c8fe6f8997..5f4156732e 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -701,10 +701,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) glh_set_current_projection(proj); glh_set_current_modelview(mod); - glMatrixMode(GL_PROJECTION); - glLoadMatrixf(proj.m); - glMatrixMode(GL_MODELVIEW); - glLoadMatrixf(mod.m); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.loadMatrix(proj.m); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.loadMatrix(mod.m); gViewerWindow->setup3DViewport(); LLGLState::checkStates(); @@ -813,13 +813,13 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) //// assumes frontmost floater with focus is opaque //if (frontmost_floaterp && gFocusMgr.childHasKeyboardFocus(frontmost_floaterp)) //{ - // glMatrixMode(GL_MODELVIEW); - // glPushMatrix(); + // gGL.matrixMode(LLRender::MM_MODELVIEW); + // gGL.pushMatrix(); // { // gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); - // glLoadIdentity(); + // gGL.loadIdentity(); // LLRect floater_rect = frontmost_floaterp->calcScreenRect(); // // deflate by one pixel so rounding errors don't occlude outside of floater extents @@ -829,8 +829,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // (F32)floater_rect.mRight / (F32)gViewerWindow->getWindowWidthScaled(), // (F32)floater_rect.mBottom / (F32)gViewerWindow->getWindowHeightScaled()); // floater_3d_rect.translate(-0.5f, -0.5f); - // glTranslatef(0.f, 0.f, -LLViewerCamera::getInstance()->getNear()); - // glScalef(LLViewerCamera::getInstance()->getNear() * LLViewerCamera::getInstance()->getAspect() / sinf(LLViewerCamera::getInstance()->getView()), LLViewerCamera::getInstance()->getNear() / sinf(LLViewerCamera::getInstance()->getView()), 1.f); + // gGL.translatef(0.f, 0.f, -LLViewerCamera::getInstance()->getNear()); + // gGL.scalef(LLViewerCamera::getInstance()->getNear() * LLViewerCamera::getInstance()->getAspect() / sinf(LLViewerCamera::getInstance()->getView()), LLViewerCamera::getInstance()->getNear() / sinf(LLViewerCamera::getInstance()->getView()), 1.f); // gGL.color4fv(LLColor4::white.mV); // gGL.begin(LLVertexBuffer::QUADS); // { @@ -842,7 +842,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) // gGL.end(); // glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); // } - // glPopMatrix(); + // gGL.popMatrix(); //} LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE; @@ -979,10 +979,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) void render_hud_attachments() { LLMemType mt_ra(LLMemType::MTYPE_DISPLAY_RENDER_ATTACHMENTS); - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); glh::matrix4f current_proj = glh_get_current_projection(); glh::matrix4f current_mod = glh_get_current_modelview(); @@ -1068,10 +1068,10 @@ void render_hud_attachments() } LLPipeline::sUseOcclusion = use_occlusion; } - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.popMatrix(); glh_set_current_projection(current_proj); glh_set_current_modelview(current_mod); @@ -1154,12 +1154,12 @@ BOOL setup_hud_matrices(const LLRect& screen_region) if (!result) return result; // set up transform to keep HUD objects in front of camera - glMatrixMode(GL_PROJECTION); - glLoadMatrixf(proj.m); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.loadMatrix(proj.m); glh_set_current_projection(proj); - glMatrixMode(GL_MODELVIEW); - glLoadMatrixf(model.m); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.loadMatrix(model.m); glh_set_current_modelview(model); return TRUE; } @@ -1175,8 +1175,8 @@ void render_ui(F32 zoom_factor, int subfield) if (!gSnapshot) { - glPushMatrix(); - glLoadMatrixd(gGLLastModelView); + gGL.pushMatrix(); + gGL.loadMatrix(gGLLastModelView); glh_set_current_modelview(glh_copy_matrix(gGLLastModelView)); } @@ -1232,7 +1232,7 @@ void render_ui(F32 zoom_factor, int subfield) if (!gSnapshot) { glh_set_current_modelview(saved_view); - glPopMatrix(); + gGL.popMatrix(); } if (gDisplaySwapBuffers) @@ -1305,10 +1305,10 @@ void draw_axes() gGL.vertex3f(0.0f, 0.0f, 40.0f); gGL.end(); // Some coordinate axes - glPushMatrix(); - glTranslatef( v.mV[VX], v.mV[VY], v.mV[VZ] ); + gGL.pushMatrix(); + gGL.translatef( v.mV[VX], v.mV[VY], v.mV[VZ] ); renderCoordinateAxes(); - glPopMatrix(); + gGL.popMatrix(); } void render_ui_3d() @@ -1378,10 +1378,10 @@ void render_ui_2d() gGL.pushMatrix(); S32 half_width = (gViewerWindow->getWorldViewWidthScaled() / 2); S32 half_height = (gViewerWindow->getWorldViewHeightScaled() / 2); - glScalef(LLUI::sGLScaleFactor.mV[0], LLUI::sGLScaleFactor.mV[1], 1.f); - glTranslatef((F32)half_width, (F32)half_height, 0.f); + gGL.scalef(LLUI::sGLScaleFactor.mV[0], LLUI::sGLScaleFactor.mV[1], 1.f); + gGL.translatef((F32)half_width, (F32)half_height, 0.f); F32 zoom = gAgentCamera.mHUDCurZoom; - glScalef(zoom,zoom,1.f); + gGL.scalef(zoom,zoom,1.f); gGL.color4fv(LLColor4::white.mV); gl_rect_2d(-half_width, half_height, half_width, -half_height, FALSE); gGL.popMatrix(); @@ -1518,20 +1518,20 @@ void render_disconnected_background() { LLGLSUIDefault gls_ui; gViewerWindow->setup2DRender(); - glPushMatrix(); + gGL.pushMatrix(); { // scale ui to reflect UIScaleFactor // this can't be done in setup2DRender because it requires a // pushMatrix/popMatrix pair const LLVector2& display_scale = gViewerWindow->getDisplayScale(); - glScalef(display_scale.mV[VX], display_scale.mV[VY], 1.f); + gGL.scalef(display_scale.mV[VX], display_scale.mV[VY], 1.f); gGL.getTexUnit(0)->bind(gDisconnectedImagep); gGL.color4f(1.f, 1.f, 1.f, 1.f); gl_rect_2d_simple_tex(width, height); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } - glPopMatrix(); + gGL.popMatrix(); } gGL.flush(); diff --git a/indra/newview/llviewerjoint.cpp b/indra/newview/llviewerjoint.cpp index baf85d6884..f2e49ff270 100644 --- a/indra/newview/llviewerjoint.cpp +++ b/indra/newview/llviewerjoint.cpp @@ -126,7 +126,7 @@ void LLViewerJoint::setValid( BOOL valid, BOOL recursive ) // //---------------------------------------------------------------- // // push matrix stack // //---------------------------------------------------------------- -// glPushMatrix(); +// gGL.pushMatrix(); // //---------------------------------------------------------------- // // render the bone to my parent @@ -140,8 +140,8 @@ void LLViewerJoint::setValid( BOOL valid, BOOL recursive ) // // offset to joint position and // // rotate to our orientation // //---------------------------------------------------------------- -// glLoadIdentity(); -// glMultMatrixf( &getWorldMatrix().mMatrix[0][0] ); +// gGL.loadIdentity(); +// gGL.multMatrix( &getWorldMatrix().mMatrix[0][0] ); // //---------------------------------------------------------------- // // render joint axes @@ -233,7 +233,7 @@ void LLViewerJoint::setValid( BOOL valid, BOOL recursive ) // //---------------------------------------------------------------- // // pop matrix stack // //---------------------------------------------------------------- -// glPopMatrix(); +// gGL.popMatrix(); // } @@ -346,7 +346,7 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy ) // F32 boneSize = 0.02f; // // rotate to point to child (bone direction) -// glPushMatrix(); +// gGL.pushMatrix(); // LLVector3 boneX = getPosition(); // F32 length = boneX.normVec(); @@ -362,7 +362,7 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy ) // rotateMat.setFwdRow( boneX ); // rotateMat.setLeftRow( boneY ); // rotateMat.setUpRow( boneZ ); -// glMultMatrixf( &rotateMat.mMatrix[0][0] ); +// gGL.multMatrix( &rotateMat.mMatrix[0][0] ); // // render the bone // gGL.color3f( 0.5f, 0.5f, 0.0f ); @@ -388,7 +388,7 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy ) // gGL.end(); // // restore matrix -// glPopMatrix(); +// gGL.popMatrix(); // } //-------------------------------------------------------------------- @@ -541,7 +541,7 @@ void LLViewerJointCollisionVolume::renderCollision() updateWorldMatrix(); gGL.pushMatrix(); - glMultMatrixf( &mXform.getWorldMatrix().mMatrix[0][0] ); + gGL.multMatrix( &mXform.getWorldMatrix().mMatrix[0][0] ); gGL.color3f( 0.f, 0.f, 1.f ); diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 2d08a27923..20ee475939 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -616,12 +616,12 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy) } else { - glPushMatrix(); + gGL.pushMatrix(); LLMatrix4 jointToWorld = getWorldMatrix(); - glMultMatrixf((GLfloat*)jointToWorld.mMatrix); + gGL.multMatrix((GLfloat*)jointToWorld.mMatrix); buff->setBuffer(mask); buff->drawRange(LLRender::TRIANGLES, start, end, count, offset); - glPopMatrix(); + gGL.popMatrix(); } gPipeline.addTrianglesDrawn(count); diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp index eff16b6a6e..6482336f37 100644 --- a/indra/newview/llviewerparceloverlay.cpp +++ b/indra/newview/llviewerparceloverlay.cpp @@ -825,14 +825,14 @@ S32 LLViewerParcelOverlay::renderPropertyLines () // Always fudge a little vertically. pull_toward_camera.mV[VZ] += 0.01f; - glMatrixMode( GL_MODELVIEW ); - glPushMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); // Move to appropriate region coords LLVector3 origin = mRegion->getOriginAgent(); - glTranslatef( origin.mV[VX], origin.mV[VY], origin.mV[VZ] ); + gGL.translatef( origin.mV[VX], origin.mV[VY], origin.mV[VZ] ); - glTranslatef(pull_toward_camera.mV[VX], pull_toward_camera.mV[VY], + gGL.translatef(pull_toward_camera.mV[VX], pull_toward_camera.mV[VY], pull_toward_camera.mV[VZ]); // Include +1 because vertices are fenceposts. @@ -931,7 +931,7 @@ S32 LLViewerParcelOverlay::renderPropertyLines () } - glPopMatrix(); + gGL.popMatrix(); return drawn; } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 95e17448bb..010bcfb125 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2275,9 +2275,9 @@ void LLViewerWindow::draw() LLUI::setLineWidth(1.f); // Reset any left-over transforms - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); - glLoadIdentity(); + gGL.loadIdentity(); //S32 screen_x, screen_y; @@ -2292,7 +2292,7 @@ void LLViewerWindow::draw() // draw timecode block std::string text; - glLoadIdentity(); + gGL.loadIdentity(); microsecondsToTimecodeString(gFrameTime,text); const LLFontGL* font = LLFontGL::getFontSansSerif(); @@ -2328,10 +2328,10 @@ void LLViewerWindow::draw() int pos_y = sub_region / llceil(zoom_factor); int pos_x = sub_region - (pos_y*llceil(zoom_factor)); // offset for this tile - glTranslatef((F32)getWindowWidthScaled() * -(F32)pos_x, + gGL.translatef((F32)getWindowWidthScaled() * -(F32)pos_x, (F32)getWindowHeightScaled() * -(F32)pos_y, 0.f); - glScalef(zoom_factor, zoom_factor, 1.f); + gGL.scalef(zoom_factor, zoom_factor, 1.f); LLUI::sGLScaleFactor *= zoom_factor; } @@ -2360,7 +2360,7 @@ void LLViewerWindow::draw() S32 screen_x, screen_y; top_ctrl->localPointToScreen(0, 0, &screen_x, &screen_y); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); LLUI::pushMatrix(); LLUI::translate( (F32) screen_x, (F32) screen_y, 0.f); top_ctrl->draw(); @@ -3424,17 +3424,17 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, LLBBox hud_bbox = gAgentAvatarp->getHUDBBox(); // set up transform to encompass bounding box of HUD - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); + gGL.loadIdentity(); F32 depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f); - glOrtho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth); + gGL.ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - glLoadMatrixf(OGL_TO_CFR_ROTATION); // Load Cory's favorite reference frame - glTranslatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); + gGL.loadIdentity(); + gGL.loadMatrix(OGL_TO_CFR_ROTATION); // Load Cory's favorite reference frame + gGL.translatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f); } // Render light for editing @@ -3444,12 +3444,12 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, LLGLEnable gls_blend(GL_BLEND); LLGLEnable gls_cull(GL_CULL_FACE); LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); if (selection->getSelectType() == SELECT_TYPE_HUD) { F32 zoom = gAgentCamera.mHUDCurZoom; - glScalef(zoom, zoom, zoom); + gGL.scalef(zoom, zoom, zoom); } struct f : public LLSelectedObjectFunctor @@ -3486,7 +3486,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, } func; LLSelectMgr::getInstance()->getSelection()->applyToObjects(&func); - glPopMatrix(); + gGL.popMatrix(); } // NOTE: The average position for the axis arrows of the selected objects should @@ -3549,11 +3549,11 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, } if (selection->getSelectType() == SELECT_TYPE_HUD && selection->getObjectCount()) { - glMatrixMode(GL_PROJECTION); - glPopMatrix(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.popMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.popMatrix(); stop_glerror(); } } diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 890861df71..4cef0f5b5b 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -882,7 +882,7 @@ void LLVOTree::updateMesh() // Translate to tree base HACK - adjustment in Z plants tree underground const LLVector3 &pos_agent = getPositionAgent(); - //glTranslatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f); + //gGL.translatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f); LLMatrix4 trans_mat; trans_mat.setTranslation(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f); trans_mat *= matrix; @@ -1158,7 +1158,8 @@ U32 LLVOTree::drawBranchPipeline(LLMatrix4& matrix, U16* indicesp, S32 trunk_LOD scale_mat.mMatrix[2][2] = scale*length; scale_mat *= matrix; - glLoadMatrixf((F32*) scale_mat.mMatrix); + gGL.loadMatrix((F32*) scale_mat.mMatrix); + gGL.syncMatrices(); glDrawElements(GL_TRIANGLES, sLODIndexCount[trunk_LOD], GL_UNSIGNED_SHORT, indicesp + sLODIndexOffset[trunk_LOD]); gPipeline.addTrianglesDrawn(LEAF_INDICES); stop_glerror(); @@ -1208,7 +1209,8 @@ U32 LLVOTree::drawBranchPipeline(LLMatrix4& matrix, U16* indicesp, S32 trunk_LOD scale_mat *= matrix; - glLoadMatrixf((F32*) scale_mat.mMatrix); + gGL.loadMatrix((F32*) scale_mat.mMatrix); + gGL.syncMatrices(); glDrawElements(GL_TRIANGLES, LEAF_INDICES, GL_UNSIGNED_SHORT, indicesp); gPipeline.addTrianglesDrawn(LEAF_INDICES); stop_glerror(); @@ -1229,19 +1231,20 @@ U32 LLVOTree::drawBranchPipeline(LLMatrix4& matrix, U16* indicesp, S32 trunk_LOD scale_mat *= matrix; - glMatrixMode(GL_TEXTURE); - glTranslatef(0.0, -0.5, 0.0); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.translatef(0.0, -0.5, 0.0); + gGL.matrixMode(LLRender::MM_MODELVIEW); - glLoadMatrixf((F32*) scale_mat.mMatrix); + gGL.loadMatrix((F32*) scale_mat.mMatrix); + gGL.syncMatrices(); glDrawElements(GL_TRIANGLES, LEAF_INDICES, GL_UNSIGNED_SHORT, indicesp); gPipeline.addTrianglesDrawn(LEAF_INDICES); stop_glerror(); ret += LEAF_INDICES; - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); } return ret; diff --git a/indra/newview/llvowlsky.cpp b/indra/newview/llvowlsky.cpp index 7b1c725483..39c9945fb4 100644 --- a/indra/newview/llvowlsky.cpp +++ b/indra/newview/llvowlsky.cpp @@ -518,6 +518,7 @@ void LLVOWLSky::drawDome(void) #else mStripsVerts->setBuffer(data_mask); + gGL.syncMatrices(); glDrawRangeElements( GL_TRIANGLES, 0, mStripsVerts->getNumVerts()-1, mStripsVerts->getNumIndices(), diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index 265d5dc801..3959e7c073 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -314,7 +314,7 @@ void LLWorldMapView::draw() { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); // Clear the background alpha to 0 gGL.flush(); @@ -1307,7 +1307,7 @@ void LLWorldMapView::drawTrackingCircle( const LLRect& rect, S32 x, S32 y, const end_theta -= angle_adjust_y; } - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); gGL.translatef((F32)x, (F32)y, 0.f); gl_washer_segment_2d(inner_radius, outer_radius, start_theta, end_theta, 40, color, color); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index b4be863c6d..60d504e948 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -2018,13 +2018,13 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl gGL.setColorMask(false, false); } - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadMatrixd(gGLLastProjection); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); + gGL.loadMatrix(gGLLastProjection); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); gGLLastMatrix = NULL; - glLoadMatrixd(gGLLastModelView); + gGL.loadMatrix(gGLLastModelView); LLVertexBuffer::unbind(); @@ -2129,10 +2129,10 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl } - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.popMatrix(); if (sUseOcclusion > 1) { @@ -3450,10 +3450,10 @@ void LLPipeline::renderHighlights() //gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); gGL.pushMatrix(); - glLoadIdentity(); - glMatrixMode(GL_PROJECTION); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.pushMatrix(); - glLoadIdentity(); + gGL.loadIdentity(); gGL.getTexUnit(0)->bind(&mHighlight); @@ -3513,7 +3513,7 @@ void LLPipeline::renderHighlights() gGL.end(); gGL.popMatrix(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.popMatrix(); //gGL.setSceneBlendType(LLRender::BT_ALPHA); @@ -3629,9 +3629,9 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) LLAppViewer::instance()->pingMainloopTimeout("Pipeline:ForceVBO"); // Initialize lots of GL state to "safe" values - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); LLGLSPipeline gls_pipeline; LLGLEnable multisample(gSavedSettings.getU32("RenderFSAASamples") > 0 ? GL_MULTISAMPLE_ARB : 0); @@ -3700,7 +3700,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) { occlude = FALSE; gGLLastMatrix = NULL; - glLoadMatrixd(gGLModelView); + gGL.loadMatrix(gGLModelView); LLGLSLShader::bindNoShader(); doOcclusion(camera); } @@ -3711,7 +3711,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) LLFastTimer t(FTM_POOLRENDER); gGLLastMatrix = NULL; - glLoadMatrixd(gGLModelView); + gGL.loadMatrix(gGLModelView); for( S32 i = 0; i < poolp->getNumPasses(); i++ ) { @@ -3760,13 +3760,13 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate) LLVertexBuffer::unbind(); gGLLastMatrix = NULL; - glLoadMatrixd(gGLModelView); + gGL.loadMatrix(gGLModelView); if (occlude) { occlude = FALSE; gGLLastMatrix = NULL; - glLoadMatrixd(gGLModelView); + gGL.loadMatrix(gGLModelView); LLGLSLShader::bindNoShader(); doOcclusion(camera); } @@ -3886,7 +3886,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera) LLFastTimer t(FTM_POOLRENDER); gGLLastMatrix = NULL; - glLoadMatrixd(gGLModelView); + gGL.loadMatrix(gGLModelView); for( S32 i = 0; i < poolp->getNumDeferredPasses(); i++ ) { @@ -3934,7 +3934,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera) } gGLLastMatrix = NULL; - glLoadMatrixd(gGLModelView); + gGL.loadMatrix(gGLModelView); gGL.setColorMask(true, false); } @@ -3967,7 +3967,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera) { occlude = FALSE; gGLLastMatrix = NULL; - glLoadMatrixd(gGLModelView); + gGL.loadMatrix(gGLModelView); LLGLSLShader::bindNoShader(); doOcclusion(camera); gGL.setColorMask(true, false); @@ -3979,7 +3979,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera) LLFastTimer t(FTM_POOLRENDER); gGLLastMatrix = NULL; - glLoadMatrixd(gGLModelView); + gGL.loadMatrix(gGLModelView); for( S32 i = 0; i < poolp->getNumPostDeferredPasses(); i++ ) { @@ -4027,17 +4027,17 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera) } gGLLastMatrix = NULL; - glLoadMatrixd(gGLModelView); + gGL.loadMatrix(gGLModelView); if (occlude) { occlude = FALSE; gGLLastMatrix = NULL; - glLoadMatrixd(gGLModelView); + gGL.loadMatrix(gGLModelView); LLGLSLShader::bindNoShader(); doOcclusion(camera); gGLLastMatrix = NULL; - glLoadMatrixd(gGLModelView); + gGL.loadMatrix(gGLModelView); } } @@ -4064,7 +4064,7 @@ void LLPipeline::renderGeomShadow(LLCamera& camera) poolp->prerender() ; gGLLastMatrix = NULL; - glLoadMatrixd(gGLModelView); + gGL.loadMatrix(gGLModelView); for( S32 i = 0; i < poolp->getNumShadowPasses(); i++ ) { @@ -4103,7 +4103,7 @@ void LLPipeline::renderGeomShadow(LLCamera& camera) } gGLLastMatrix = NULL; - glLoadMatrixd(gGLModelView); + gGL.loadMatrix(gGLModelView); } @@ -4177,10 +4177,10 @@ void LLPipeline::renderPhysicsDisplay() LLSpatialBridge* bridge = *i; if (!bridge->isDead() && hasRenderType(bridge->mDrawableType)) { - glPushMatrix(); - glMultMatrixf((F32*)bridge->mDrawable->getRenderMatrix().mMatrix); + gGL.pushMatrix(); + gGL.multMatrix((F32*)bridge->mDrawable->getRenderMatrix().mMatrix); bridge->renderPhysicsShapes(); - glPopMatrix(); + gGL.popMatrix(); } } @@ -4204,7 +4204,7 @@ void LLPipeline::renderDebug() gGL.color4f(1,1,1,1); gGLLastMatrix = NULL; - glLoadMatrixd(gGLModelView); + gGL.loadMatrix(gGLModelView); gGL.setColorMask(true, false); bool hud_only = hasRenderType(LLPipeline::RENDER_TYPE_HUD); @@ -4264,10 +4264,10 @@ void LLPipeline::renderDebug() LLSpatialBridge* bridge = *i; if (!bridge->isDead() && hasRenderType(bridge->mDrawableType)) { - glPushMatrix(); - glMultMatrixf((F32*)bridge->mDrawable->getRenderMatrix().mMatrix); + gGL.pushMatrix(); + gGL.multMatrix((F32*)bridge->mDrawable->getRenderMatrix().mMatrix); bridge->renderDebug(); - glPopMatrix(); + gGL.popMatrix(); } } @@ -4455,7 +4455,7 @@ void LLPipeline::renderDebug() gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep); gGL.pushMatrix(); - glLoadMatrixd(gGLModelView); + gGL.loadMatrix(gGLModelView); gGLLastMatrix = NULL; for (LLSpatialGroup::sg_vector_t::iterator iter = mGroupQ2.begin(); iter != mGroupQ2.end(); ++iter) @@ -4476,7 +4476,7 @@ void LLPipeline::renderDebug() if (bridge) { gGL.pushMatrix(); - glMultMatrixf((F32*)bridge->mDrawable->getRenderMatrix().mMatrix); + gGL.multMatrix((F32*)bridge->mDrawable->getRenderMatrix().mMatrix); } F32 alpha = llclamp((F32) (size-count)/size, 0.f, 1.f); @@ -4824,6 +4824,8 @@ void LLPipeline::setupAvatarLights(BOOL for_edit) { assertInitialized(); + gGL.syncMatrices(); + if (for_edit) { LLColor4 diffuse(1.f, 1.f, 1.f, 0.f); @@ -5052,6 +5054,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera) void LLPipeline::setupHWLights(LLDrawPool* pool) { assertInitialized(); + gGL.syncMatrices(); // Ambient LLColor4 ambient = gSky.getTotalAmbientColor(); @@ -5332,6 +5335,8 @@ void LLPipeline::enableLightsPreview() { disableLights(); + gGL.syncMatrices(); + glEnable(GL_LIGHTING); LLColor4 ambient = gSavedSettings.getColor4("PreviewAmbientColor"); glLightModelfv(GL_LIGHT_MODEL_AMBIENT,ambient.mV); @@ -6096,10 +6101,10 @@ void LLPipeline::renderObjects(U32 type, U32 mask, BOOL texture) { LLMemType mt_ro(LLMemType::MTYPE_PIPELINE_RENDER_OBJECTS); assertInitialized(); - glLoadMatrixd(gGLModelView); + gGL.loadMatrix(gGLModelView); gGLLastMatrix = NULL; mSimplePool->pushBatches(type, mask); - glLoadMatrixd(gGLModelView); + gGL.loadMatrix(gGLModelView); gGLLastMatrix = NULL; } @@ -6108,25 +6113,25 @@ void apply_cube_face_rotation(U32 face) switch (face) { case 0: - glRotatef(90.f, 0, 1, 0); - glRotatef(180.f, 1, 0, 0); + gGL.rotatef(90.f, 0, 1, 0); + gGL.rotatef(180.f, 1, 0, 0); break; case 2: - glRotatef(-90.f, 1, 0, 0); + gGL.rotatef(-90.f, 1, 0, 0); break; case 4: - glRotatef(180.f, 0, 1, 0); - glRotatef(180.f, 0, 0, 1); + gGL.rotatef(180.f, 0, 1, 0); + gGL.rotatef(180.f, 0, 0, 1); break; case 1: - glRotatef(-90.f, 0, 1, 0); - glRotatef(180.f, 1, 0, 0); + gGL.rotatef(-90.f, 0, 1, 0); + gGL.rotatef(180.f, 1, 0, 0); break; case 3: - glRotatef(90, 1, 0, 0); + gGL.rotatef(90, 1, 0, 0); break; case 5: - glRotatef(180, 0, 0, 1); + gGL.rotatef(180, 0, 0, 1); break; } } @@ -6204,12 +6209,12 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) enableLightsFullbright(LLColor4(1,1,1,1)); - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); + gGL.loadIdentity(); LLGLDisable test(GL_ALPHA_TEST); @@ -6662,10 +6667,10 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield) } - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.popMatrix(); LLVertexBuffer::unbind(); @@ -7116,11 +7121,11 @@ void LLPipeline::renderDeferredLighting() mTransformedSunDir.set(tc.v); } - glPushMatrix(); - glLoadIdentity(); - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); + gGL.pushMatrix(); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); + gGL.loadIdentity(); if (gSavedSettings.getBOOL("RenderDeferredSSAO") || gSavedSettings.getS32("RenderShadowDetail") > 0) { @@ -7340,11 +7345,11 @@ void LLPipeline::renderDeferredLighting() } stop_glerror(); - glPopMatrix(); + gGL.popMatrix(); stop_glerror(); - glMatrixMode(GL_MODELVIEW); + gGL.matrixMode(LLRender::MM_MODELVIEW); stop_glerror(); - glPopMatrix(); + gGL.popMatrix(); stop_glerror(); //copy depth and stencil from deferred screen @@ -7376,19 +7381,19 @@ void LLPipeline::renderDeferredLighting() LLGLDisable test(GL_ALPHA_TEST); //full screen blit - glPushMatrix(); - glLoadIdentity(); - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); + gGL.pushMatrix(); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); + gGL.loadIdentity(); mDeferredVB->setBuffer(LLVertexBuffer::MAP_VERTEX); mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.popMatrix(); } unbindDeferredShader(gDeferredSoftenProgram); @@ -7528,6 +7533,7 @@ void LLPipeline::renderDeferredLighting() gDeferredLightProgram.uniform3fv("color", 1, col.mV); gDeferredLightProgram.uniform1f("falloff", volume->getLightFalloff()*0.5f); //gGL.diffuseColor4f(col.mV[0], col.mV[1], col.mV[2], volume->getLightFalloff()*0.5f); + gGL.syncMatrices(); glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8, GL_UNSIGNED_BYTE, get_box_fan_indices_ptr(camera, center)); stop_glerror(); @@ -7598,6 +7604,7 @@ void LLPipeline::renderDeferredLighting() gDeferredSpotLightProgram.uniform1f("size", s*s); gDeferredSpotLightProgram.uniform3fv("color", 1, col.mV); gDeferredSpotLightProgram.uniform1f("falloff", volume->getLightFalloff()*0.5f); + gGL.syncMatrices(); glDrawRangeElements(GL_TRIANGLE_FAN, 0, 7, 8, GL_UNSIGNED_BYTE, get_box_fan_indices_ptr(camera, center)); } @@ -7618,11 +7625,11 @@ void LLPipeline::renderDeferredLighting() LLGLDepthTest depth(GL_FALSE); //full screen blit - glPushMatrix(); - glLoadIdentity(); - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); + gGL.pushMatrix(); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); + gGL.loadIdentity(); U32 count = 0; @@ -7697,9 +7704,9 @@ void LLPipeline::renderDeferredLighting() gDeferredMultiSpotLightProgram.disableTexture(LLViewerShaderMgr::DEFERRED_PROJECTION); unbindDeferredShader(gDeferredMultiSpotLightProgram); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.popMatrix(); } } @@ -7730,17 +7737,17 @@ void LLPipeline::renderDeferredLighting() // glVertexPointer(2, GL_FLOAT, 0, vert); gGL.diffuseColor3f(1,1,1); - glPushMatrix(); - glLoadIdentity(); - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); + gGL.pushMatrix(); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); + gGL.loadIdentity(); mDeferredVB->drawArrays(LLRender::TRIANGLES, 0, 3); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.popMatrix(); unbindDeferredShader(gDeferredPostProgram); } @@ -8078,7 +8085,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) stop_glerror(); - glPushMatrix(); + gGL.pushMatrix(); mat.set_scale(glh::vec3f(1,1,-1)); mat.set_translate(glh::vec3f(0,0,height*2.f)); @@ -8088,7 +8095,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) mat = current * mat; glh_set_current_modelview(mat); - glLoadMatrixf(mat.m); + gGL.loadMatrix(mat.m); LLViewerCamera::updateFrustumPlanes(camera, FALSE, TRUE); @@ -8166,7 +8173,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) gPipeline.popRenderTypeMask(); } glCullFace(GL_BACK); - glPopMatrix(); + gGL.popMatrix(); mWaterRef.flush(); glh_set_current_modelview(current); LLPipeline::sUseOcclusion = occlusion; @@ -8347,12 +8354,12 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera stateSort(shadow_cam, result); //generate shadow map - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadMatrixf(proj.m); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadMatrixd(gGLModelView); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); + gGL.loadMatrix(proj.m); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); + gGL.loadMatrix(gGLModelView); stop_glerror(); gGLLastMatrix = NULL; @@ -8417,7 +8424,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera gDeferredShadowProgram.bind(); gGLLastMatrix = NULL; - glLoadMatrixd(gGLModelView); + gGL.loadMatrix(gGLModelView); doOcclusion(shadow_cam); if (use_shader) @@ -8427,10 +8434,10 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera gGL.setColorMask(true, true); - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.popMatrix(); gGLLastMatrix = NULL; LLPipeline::sUseOcclusion = occlude; @@ -8757,12 +8764,12 @@ void LLPipeline::generateGI(LLCamera& camera, LLVector3& lightDir, std::vector<L LLGLEnable cull(GL_CULL_FACE); //generate GI map - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadMatrixf(proj.m); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadMatrixf(view.m); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); + gGL.loadMatrix(proj.m); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); + gGL.loadMatrix(view.m); stop_glerror(); gGLLastMatrix = NULL; @@ -8776,10 +8783,10 @@ void LLPipeline::generateGI(LLCamera& camera, LLVector3& lightDir, std::vector<L mGIMap.flush(); - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.popMatrix(); gGLLastMatrix = NULL; LLPipeline::sUseOcclusion = occlude; @@ -9564,10 +9571,10 @@ void LLPipeline::generateSunShadow(LLCamera& camera) { glh_set_current_modelview(view[1]); glh_set_current_projection(proj[1]); - glLoadMatrixf(view[1].m); - glMatrixMode(GL_PROJECTION); - glLoadMatrixf(proj[1].m); - glMatrixMode(GL_MODELVIEW); + gGL.loadMatrix(view[1].m); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.loadMatrix(proj[1].m); + gGL.matrixMode(LLRender::MM_MODELVIEW); } gGL.setColorMask(true, false); @@ -9699,24 +9706,24 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) tdim.mV[0] = fabsf(half_height.dot3(left).getF32()); tdim.mV[1] = fabsf(half_height.dot3(up).getF32()); - glMatrixMode(GL_PROJECTION); - glPushMatrix(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); F32 distance = (pos-camera.getOrigin()).length(); F32 fov = atanf(tdim.mV[1]/distance)*2.f*RAD_TO_DEG; F32 aspect = tdim.mV[0]/tdim.mV[1]; glh::matrix4f persp = gl_perspective(fov, aspect, 1.f, 256.f); glh_set_current_projection(persp); - glLoadMatrixf(persp.m); + gGL.loadMatrix(persp.m); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); glh::matrix4f mat; camera.getOpenGLTransform(mat.m); mat = glh::matrix4f((GLfloat*) OGL_TO_CFR_ROTATION) * mat; - glLoadMatrixf(mat.m); + gGL.loadMatrix(mat.m); glh_set_current_modelview(mat); glClearColor(0.0f,0.0f,0.0f,0.0f); @@ -9784,11 +9791,11 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) gGL.flush(); - glPushMatrix(); - glLoadIdentity(); - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); + gGL.pushMatrix(); + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.pushMatrix(); + gGL.loadIdentity(); static const F32 clip_plane = 0.99999f; @@ -9811,9 +9818,9 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) gUIProgram.unbind(); } - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.popMatrix(); } avatar->mImpostor.flush(); @@ -9827,10 +9834,10 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar) sShadowRender = FALSE; popRenderTypeMask(); - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); + gGL.matrixMode(LLRender::MM_PROJECTION); + gGL.popMatrix(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.popMatrix(); avatar->mNeedsImpostorUpdate = FALSE; avatar->cacheImpostorValues(); |