diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index e81eaf6d229fca2528f22c4dc6d8d0cf31b6ab23..5c0e1c9c3bd729b68f91ab52088a31bed34927a4 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -1087,7 +1087,7 @@ LLRender::LLRender() mQuadCycle(0), mMode(LLRender::TRIANGLES), mCurrTextureUnitIndex(0), - mMaxAnisotropy(0.f) + mLineWidth(1.f) { mTexUnits.reserve(LL_NUM_TEXTURE_LAYERS); for (U32 i = 0; i < LL_NUM_TEXTURE_LAYERS; i++) @@ -1845,6 +1845,22 @@ void LLRender::setAmbientLightColor(const LLColor4& color) } } } +void LLRender::setLineWidth(F32 line_width) +{ + if (LLRender::sGLCoreProfile) + { + line_width = 1.f; + } + if (mLineWidth != line_width || mDirty) + { + if (mMode == LLRender::LINES || mMode == LLRender::LINE_STRIP) + { + flush(); + } + mLineWidth = line_width; + glLineWidth(line_width); + } +} bool LLRender::verifyTexUnitActive(U32 unitToVerify) { diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 41f4fe40176620087a214303dd732498ed7b0e06..cd6dcf19514326d8e4bddb66e9179c4d5d212aa0 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -441,6 +441,8 @@ class LLRender LLLightState* getLight(U32 index); void setAmbientLightColor(const LLColor4& color); + void setLineWidth(F32 line_width); + LLTexUnit* getTexUnit(U32 index); U32 getCurrentTexUnitIndex(void) const { return mCurrTextureUnitIndex; } @@ -483,6 +485,7 @@ class LLRender bool mCurrColorMask[4]; eCompareFunc mCurrAlphaFunc; F32 mCurrAlphaFuncVal; + F32 mLineWidth; LLPointer<LLVertexBuffer> mBuffer; LLStrider<LLVector3> mVerticesp; diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index 5d526ea6025fc0cca65baf717e8710f2eed277bc..f82b1b94341925fb0cabffbbf4c4492569edcaaf 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -784,7 +784,7 @@ void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LL gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], color.mV[VALPHA]); gGL.flush(); - glLineWidth(2.5f); + gGL.setLineWidth(2.5f); if (!LLGLSLShader::sNoFixedFunction) { @@ -1633,8 +1633,7 @@ void LLRender2D::setScaleFactor(const LLVector2 &scale_factor) // static void LLRender2D::setLineWidth(F32 width) { - gGL.flush(); - glLineWidth(width * lerp(sGLScaleFactor.mV[VX], sGLScaleFactor.mV[VY], 0.5f)); + gGL.setLineWidth(width * lerp(sGLScaleFactor.mV[VX], sGLScaleFactor.mV[VY], 0.5f)); } // static diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index c57b1f2eb25aa2c265a97422abb3f5d4e88a54d1..90088975bd07a8952451d972529c886e9f91196b 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -691,7 +691,7 @@ void LLFace::renderOneWireframe(const LLColor4 &color, F32 fogCfx, bool wirefram LLGLEnable offset(GL_POLYGON_OFFSET_LINE); glPolygonOffset(3.f, 3.f); - glLineWidth(5.f); + gGL.setLineWidth(5.f); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); renderFace(mDrawablep, this); } diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 995f4680a3123c1d0b7c43c65f607b94ab79fc50..ffbfdf9476dc75cfac9afce695c40e0b1d72b44f 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -1072,8 +1072,7 @@ void LLFastTimerView::drawLineGraph() //fatten highlighted timer if (mHoverID == idp) { - gGL.flush(); - glLineWidth(3); + gGL.setLineWidth(3); } llassert(idp->getIndex() < sTimerColors.size()); @@ -1132,8 +1131,7 @@ void LLFastTimerView::drawLineGraph() if (mHoverID == idp) { - gGL.flush(); - glLineWidth(1); + gGL.setLineWidth(1); } if (idp->getTreeNode().mCollapsed) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 6181977c6a445c3d1874550a797b9b5d069d86ae..7a90cc504f1bb5aaf813b3d0cb9f0209f53961c0 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3903,11 +3903,11 @@ BOOL LLModelPreview::render() if (edges) { - glLineWidth(3.f); + gGL.setLineWidth(3.f); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - glLineWidth(1.f); + gGL.setLineWidth(1.f); } } gGL.popMatrix(); @@ -4021,19 +4021,19 @@ BOOL LLModelPreview::render() gGL.diffuseColor3f(1.f, 1.f, 0.f); - glLineWidth(2.f); + gGL.setLineWidth(2.f); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - glLineWidth(1.f); + gGL.setLineWidth(1.f); } } gGL.popMatrix(); } - glLineWidth(3.f); + gGL.setLineWidth(3.f); glPointSize(8.f); gPipeline.enableLightsFullbright(); //show degenerate triangles @@ -4104,7 +4104,7 @@ BOOL LLModelPreview::render() gGL.popMatrix(); } - glLineWidth(1.f); + gGL.setLineWidth(1.f); glPointSize(1.f); gPipeline.enableLightsPreview(); gGL.setSceneBlendType(LLRender::BT_ALPHA); @@ -4193,11 +4193,11 @@ BOOL LLModelPreview::render() if (edges) { - glLineWidth(3.f); + gGL.setLineWidth(3.f); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); buffer->draw(LLRender::TRIANGLES, buffer->getNumIndices(), 0); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - glLineWidth(1.f); + gGL.setLineWidth(1.f); } } } diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 4a69f423bda4703e70d3d56377f883437139af73..a01882bbad3eeacbc6cf4aedc0473e5d9d60631d 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -6082,7 +6082,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) gGL.popMatrix(); gGL.popMatrix(); - glLineWidth(1.f); + gGL.setLineWidth(1.f); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); if (shader) diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index 65d1b2f3391d3cce78981f890de3f9b3e4912b74..2fda969c47115da72f118046d39b897291c8fa0a 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -239,11 +239,11 @@ void LLSnapshotLivePreview::drawPreviewRect(S32 offset_x, S32 offset_y) { F32 line_width ; glGetFloatv(GL_LINE_WIDTH, &line_width) ; - glLineWidth(2.0f * line_width) ; + gGL.setLineWidth(2.0f * line_width) ; LLColor4 color(0.0f, 0.0f, 0.0f, 1.0f) ; gl_rect_2d( mPreviewRect.mLeft + offset_x, mPreviewRect.mTop + offset_y, mPreviewRect.mRight + offset_x, mPreviewRect.mBottom + offset_y, color, FALSE ) ; - glLineWidth(line_width) ; + gGL.setLineWidth(line_width) ; //draw four alpha rectangles to cover areas outside of the snapshot image if(!mKeepAspectRatio) diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 866a6fc6bf047580653fe8edfea8d7f1cd5962ab..91ef096ab6a52ec277b576415ac429a9c6db5c25 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -1719,12 +1719,12 @@ void renderOctree(LLSpatialGroup* group) gGL.diffuseColor4f(1,0,0,group->mBuilt); gGL.flush(); - glLineWidth(5.f); + gGL.setLineWidth(5.f); const LLVector4a* bounds = group->getObjectBounds(); drawBoxOutline(bounds[0], bounds[1]); gGL.flush(); - glLineWidth(1.f); + gGL.setLineWidth(1.f); gGL.flush(); for (LLSpatialGroup::element_iter i = group->getDataBegin(), i_end = group->getDataEnd(); i != i_end; ++i) { @@ -1861,10 +1861,10 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera) pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX, false); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - glLineWidth(4.f); + gGL.setLineWidth(4.f); gGL.diffuseColor4f(0.f, 0.5f, 0.f, 1.f); pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX, false); - glLineWidth(1.f); + gGL.setLineWidth(1.f); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); bool selected = false; @@ -2239,12 +2239,12 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE) if (vobj && vobj->onActiveList()) { gGL.flush(); - glLineWidth(llmax(4.f*sinf(gFrameTimeSeconds*2.f)+1.f, 1.f)); - //glLineWidth(4.f*(sinf(gFrameTimeSeconds*2.f)*0.25f+0.75f)); + gGL.setLineWidth(llmax(4.f*sinf(gFrameTimeSeconds*2.f)+1.f, 1.f)); + //gGL.setLineWidth(4.f*(sinf(gFrameTimeSeconds*2.f)*0.25f+0.75f)); stop_glerror(); drawBoxOutline(pos,size); gGL.flush(); - glLineWidth(1.f); + gGL.setLineWidth(1.f); } else { @@ -2358,10 +2358,10 @@ void render_hull(LLModel::PhysicsMesh& mesh, const LLColor4& color, const LLColo LLGLEnable offset(GL_POLYGON_OFFSET_LINE); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glPolygonOffset(3.f, 3.f); - glLineWidth(3.f); + gGL.setLineWidth(3.f); gGL.diffuseColor4fv(line_color.mV); LLVertexBuffer::drawArrays(LLRender::TRIANGLES, mesh.mPositions, mesh.mNormals); - glLineWidth(1.f); + gGL.setLineWidth(1.f); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } @@ -3092,7 +3092,7 @@ class LLRenderOctreeRaycast : public LLOctreeTriangleRayIntersect if (i == 1) { gGL.flush(); - glLineWidth(3.f); + gGL.setLineWidth(3.f); } gGL.begin(LLRender::TRIANGLES); @@ -3111,7 +3111,7 @@ class LLRenderOctreeRaycast : public LLOctreeTriangleRayIntersect if (i == 1) { gGL.flush(); - glLineWidth(1.f); + gGL.setLineWidth(1.f); } } } @@ -3706,11 +3706,11 @@ void LLSpatialPartition::renderPhysicsShapes() gGL.flush(); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - glLineWidth(3.f); + gGL.setLineWidth(3.f); LLOctreeRenderPhysicsShapes render_physics(camera); render_physics.traverse(mOctree); gGL.flush(); - glLineWidth(1.f); + gGL.setLineWidth(1.f); } void LLSpatialPartition::renderDebug() diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4b48ba048f4b4716e7015dcf5499e352c11c1ddb..61183eae5a5fe8ed2dd2dd3bf67cd7e17cc79f5d 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5118,7 +5118,7 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel) gGL.begin(LLRender::LINES); gGL.color4f(1.f,1.f,1.f,1.f); F32 thickness = llmax(F32(5.0f-5.0f*(gFrameTimeSeconds-mLastImpostorUpdateFrameTime)),1.0f); - glLineWidth(thickness); + gGL.setLineWidth(thickness); gGL.vertex3fv((pos+left-up).mV); gGL.vertex3fv((pos-left-up).mV); gGL.vertex3fv((pos-left-up).mV);