From 14f6bbadef2c39e58a3b54c0c6212949acf50e45 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 8 Aug 2011 15:29:23 -0500 Subject: SH-2242 Work in progress migrating to glVertexAttrib everywhere --- indra/newview/llfloatermodelpreview.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index ab6753b4be..9f9bbee4b5 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -4826,7 +4826,7 @@ BOOL LLModelPreview::render() if (textures) { - glColor4fv(instance.mMaterial[i].mDiffuseColor.mV); + gGL.diffuseColor4fv(instance.mMaterial[i].mDiffuseColor.mV); if (i < instance.mMaterial.size() && instance.mMaterial[i].mDiffuseMap.notNull()) { if (instance.mMaterial[i].mDiffuseMap->getDiscardLevel() > -1) @@ -4838,12 +4838,12 @@ BOOL LLModelPreview::render() } else { - glColor4f(1,1,1,1); + gGL.diffuseColor4f(1,1,1,1); } buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - glColor3f(0.4f, 0.4f, 0.4f); + gGL.diffuseColor3f(0.4f, 0.4f, 0.4f); if (edges) { @@ -4945,11 +4945,11 @@ BOOL LLModelPreview::render() buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - glColor4f(0.4f, 0.4f, 0.0f, 0.4f); + gGL.diffuseColor4f(0.4f, 0.4f, 0.0f, 0.4f); buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0); - glColor3f(1.f, 1.f, 0.f); + gGL.diffuseColor3f(1.f, 1.f, 0.f); glLineWidth(2.f); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); @@ -4969,7 +4969,7 @@ BOOL LLModelPreview::render() //show degenerate triangles LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS); LLGLDisable cull(GL_CULL_FACE); - glColor4f(1.f,0.f,0.f,1.f); + gGL.diffuseColor4f(1.f,0.f,0.f,1.f); const LLVector4a scale(0.5f); for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter) @@ -5133,10 +5133,10 @@ BOOL LLModelPreview::render() } buffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0); - glColor4fv(instance.mMaterial[i].mDiffuseColor.mV); + gGL.diffuseColor4fv(instance.mMaterial[i].mDiffuseColor.mV); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); buffer->draw(LLRender::TRIANGLES, buffer->getNumIndices(), 0); - glColor3f(0.4f, 0.4f, 0.4f); + gGL.diffuseColor3f(0.4f, 0.4f, 0.4f); if (edges) { -- cgit v1.2.3 From 2ee815478043c4d5845f094f744a055707dba0e0 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 10 Aug 2011 13:01:14 -0500 Subject: SH-2238, SH-2223, SH-SH-2242 glVertexAttrib throughout main render pipeline complete, preview renders and debug displays still pending. Also fixed a render glitch and a crash (JIRAs listed). --- indra/newview/llfloatermodelpreview.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatermodelpreview.cpp') diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 3286408f21..b9838f7da2 100755 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -3623,6 +3623,15 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim LLVertexBuffer::unbind(); + bool no_ff = LLGLSLShader::sNoFixedFunction; + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + LLGLSLShader::sNoFixedFunction = false; + + if (shader) + { + shader->unbind(); + } + stop_gloderror(); static U32 cur_name = 1; @@ -4003,6 +4012,13 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim mResourceCost = calcResourceCost(); + LLVertexBuffer::unbind(); + LLGLSLShader::sNoFixedFunction = no_ff; + if (shader) + { + shader->bind(); + } + /*if (which_lod == -1 && mScene[LLModel::LOD_PHYSICS].empty()) { //build physics scene mScene[LLModel::LOD_PHYSICS] = mScene[LLModel::LOD_LOW]; @@ -4950,7 +4966,7 @@ BOOL LLModelPreview::render() llassert(binding == model->mMaterialList[i]); - gGL.diffuseColor4fv(instance.mMaterial[i].mDiffuseColor.mV); + gGL.diffuseColor4fv(material.mDiffuseColor.mV); if (material.mDiffuseMap.notNull()) { @@ -5261,7 +5277,7 @@ BOOL LLModelPreview::render() const LLImportMaterial& material = instance.mMaterial[binding]; buffer->setBuffer(type_mask & buffer->getTypeMask()); - gGL.diffuseColor4fv(instance.mMaterial[i].mDiffuseColor.mV); + gGL.diffuseColor4fv(material.mDiffuseColor.mV); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); buffer->draw(LLRender::TRIANGLES, buffer->getNumIndices(), 0); gGL.diffuseColor3f(0.4f, 0.4f, 0.4f); -- cgit v1.2.3