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/lldrawpoolwater.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'indra/newview/lldrawpoolwater.cpp') diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 31c14361b5..ae1598907b 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -219,7 +219,7 @@ void LLDrawPoolWater::render(S32 pass) water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot)); } - glColor4fv(water_color.mV); + gGL.diffuseColor4fv(water_color.mV); // Automatically generate texture coords for detail map glEnable(GL_TEXTURE_GEN_S); //texture unit 1 @@ -383,7 +383,7 @@ void LLDrawPoolWater::renderOpaqueLegacyWater() glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); - glColor3f(1.f, 1.f, 1.f); + gGL.diffuseColor3f(1.f, 1.f, 1.f); for (std::vector::iterator iter = mDrawFace.begin(); iter != mDrawFace.end(); iter++) @@ -623,8 +623,6 @@ void LLDrawPoolWater::shade() water_color.mV[3] = 0.9f; } - glColor4fv(water_color.mV); - { LLGLEnable depth_clamp(gGLManager.mHasDepthClamp ? GL_DEPTH_CLAMP : 0); LLGLDisable cullface(GL_CULL_FACE); -- cgit v1.2.3 From 7c95af74f195c9ec4ebc0fc0264d98cd4a85be49 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 14 Sep 2011 16:30:45 -0500 Subject: SH-2243 work in progress -- application side matrix stack management --- indra/newview/lldrawpoolwater.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'indra/newview/lldrawpoolwater.cpp') 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); } -- cgit v1.2.3 From f49e7014ca9693d77ff265d3fc668a8b05ddf085 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Sat, 24 Sep 2011 23:29:38 -0500 Subject: SH-2244 Fix for crash when transparent water disabled (silently ignore setting when basic shaders enabled) --- indra/newview/lldrawpoolwater.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/lldrawpoolwater.cpp') diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index c97f92fa6f..5de0b8c796 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -167,7 +167,7 @@ void LLDrawPoolWater::render(S32 pass) std::sort(mDrawFace.begin(), mDrawFace.end(), LLFace::CompareDistanceGreater()); // See if we are rendering water as opaque or not - if (!gSavedSettings.getBOOL("RenderTransparentWater")) + if (!gSavedSettings.getBOOL("RenderTransparentWater") && !LLGLSLShader::sNoFixedFunction) { // render water for low end hardware renderOpaqueLegacyWater(); @@ -332,6 +332,11 @@ void LLDrawPoolWater::renderOpaqueLegacyWater() { LLVOSky *voskyp = gSky.mVOSkyp; + if (LLGLSLShader::sNoFixedFunction) + { + gObjectSimpleProgram.bind(); + } + stop_glerror(); // Depth sorting and write to depth buffer -- cgit v1.2.3 From 54ba56dbe995a3d215f85932c83948145a871ac4 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 26 Sep 2011 18:31:55 -0500 Subject: SH-2244 changes to run in a core context on AMD hardware without generating deprecation or performance warnings --- indra/newview/lldrawpoolwater.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/lldrawpoolwater.cpp') diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 5de0b8c796..f6fe96877d 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -59,6 +59,8 @@ BOOL LLDrawPoolWater::sSkipScreenCopy = FALSE; BOOL LLDrawPoolWater::sNeedsReflectionUpdate = TRUE; BOOL LLDrawPoolWater::sNeedsDistortionUpdate = TRUE; LLColor4 LLDrawPoolWater::sWaterFogColor = LLColor4(0.2f, 0.5f, 0.5f, 0.f); +F32 LLDrawPoolWater::sWaterFogEnd = 0.f; + LLVector3 LLDrawPoolWater::sLightDir; LLDrawPoolWater::LLDrawPoolWater() : -- cgit v1.2.3 From 2322c57b4dd2b4338eec2ca9db2425eff4bfd6d5 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 11 Oct 2011 14:55:33 -0500 Subject: SH-2545 Fix for transparent water option doing nothing when shaders are enabled. --- indra/newview/lldrawpoolwater.cpp | 46 +++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 11 deletions(-) (limited to 'indra/newview/lldrawpoolwater.cpp') diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index f6fe96877d..4f6eaa5a5b 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -169,7 +169,7 @@ void LLDrawPoolWater::render(S32 pass) std::sort(mDrawFace.begin(), mDrawFace.end(), LLFace::CompareDistanceGreater()); // See if we are rendering water as opaque or not - if (!gSavedSettings.getBOOL("RenderTransparentWater") && !LLGLSLShader::sNoFixedFunction) + if (!gSavedSettings.getBOOL("RenderTransparentWater")) { // render water for low end hardware renderOpaqueLegacyWater(); @@ -334,9 +334,19 @@ void LLDrawPoolWater::renderOpaqueLegacyWater() { LLVOSky *voskyp = gSky.mVOSkyp; + LLGLSLShader* shader = NULL; if (LLGLSLShader::sNoFixedFunction) { - gObjectSimpleProgram.bind(); + if (LLPipeline::sUnderWaterRender) + { + shader = &gObjectSimpleNonIndexedTexGenWaterProgram; + } + else + { + shader = &gObjectSimpleNonIndexedTexGenProgram; + } + + shader->bind(); } stop_glerror(); @@ -361,10 +371,13 @@ void LLDrawPoolWater::renderOpaqueLegacyWater() gGL.getTexUnit(0)->bind(mOpaqueWaterImagep); // Automatically generate texture coords for water texture - glEnable(GL_TEXTURE_GEN_S); //texture unit 0 - glEnable(GL_TEXTURE_GEN_T); //texture unit 0 - glTexGenf(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGenf(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + if (!shader) + { + glEnable(GL_TEXTURE_GEN_S); //texture unit 0 + glEnable(GL_TEXTURE_GEN_T); //texture unit 0 + glTexGenf(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + glTexGenf(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + } // Use the fact that we know all water faces are the same size // to save some computation @@ -387,8 +400,16 @@ void LLDrawPoolWater::renderOpaqueLegacyWater() F32 tp0[4] = { 16.f / 256.f, 0.0f, 0.0f, offset }; F32 tp1[4] = { 0.0f, 16.f / 256.f, 0.0f, offset }; - glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); - glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); + if (!shader) + { + glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); + glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); + } + else + { + shader->uniform4fv("object_plane_s", 1, tp0); + shader->uniform4fv("object_plane_t", 1, tp1); + } gGL.diffuseColor3f(1.f, 1.f, 1.f); @@ -406,9 +427,12 @@ void LLDrawPoolWater::renderOpaqueLegacyWater() stop_glerror(); - // Reset the settings back to expected values - glDisable(GL_TEXTURE_GEN_S); //texture unit 0 - glDisable(GL_TEXTURE_GEN_T); //texture unit 0 + if (!shader) + { + // Reset the settings back to expected values + glDisable(GL_TEXTURE_GEN_S); //texture unit 0 + glDisable(GL_TEXTURE_GEN_T); //texture unit 0 + } gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); -- cgit v1.2.3