From da84f5552731e1ece3a463c4c385bb327f1048a1 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Fri, 16 Sep 2011 12:40:53 -0500
Subject: [PATCH] SH-2243 work in progress -- don't use deprecated shader state

---
 indra/llrender/llshadermgr.cpp                | 39 ++++++++++++++++---
 .../shaders/class1/avatar/avatarSkinV.glsl    |  2 +-
 .../shaders/class1/avatar/avatarV.glsl        | 16 +++++---
 .../shaders/class1/avatar/eyeballV.glsl       | 15 ++++---
 .../shaders/class1/avatar/objectSkinV.glsl    |  2 +-
 .../shaders/class1/avatar/pickAvatarF.glsl    |  5 ++-
 .../shaders/class1/avatar/pickAvatarV.glsl    | 13 ++++---
 .../shaders/class1/deferred/alphaF.glsl       | 17 ++++----
 .../class1/deferred/alphaNonIndexedF.glsl     | 16 ++++----
 .../deferred/alphaNonIndexedNoColorF.glsl     | 33 ++++++++++++----
 .../class1/deferred/alphaSkinnedV.glsl        | 29 +++++++-------
 .../shaders/class1/deferred/alphaV.glsl       | 31 ++++++++-------
 .../class1/deferred/attachmentShadowF.glsl    |  4 +-
 .../class1/deferred/attachmentShadowV.glsl    | 13 ++++---
 .../shaders/class1/deferred/avatarAlphaV.glsl | 25 ++++++------
 .../shaders/class1/deferred/avatarEyesV.glsl  | 16 ++++----
 .../shaders/class1/deferred/avatarF.glsl      |  5 ++-
 .../class1/deferred/avatarShadowF.glsl        |  2 +-
 .../class1/deferred/avatarShadowV.glsl        | 11 +++---
 .../shaders/class1/deferred/avatarV.glsl      | 13 ++++---
 .../shaders/class1/deferred/blurLightF.glsl   |  2 +-
 .../shaders/class1/deferred/blurLightV.glsl   |  4 +-
 .../shaders/class1/deferred/bumpF.glsl        | 17 ++++----
 .../shaders/class1/deferred/bumpSkinnedV.glsl | 22 ++++++-----
 .../shaders/class1/deferred/bumpV.glsl        | 22 ++++++-----
 .../shaders/class1/deferred/cloudsF.glsl      | 19 +++++----
 .../shaders/class1/deferred/cloudsV.glsl      | 35 ++++++++++-------
 .../class1/deferred/diffuseAlphaMaskF.glsl    |  6 ++-
 .../deferred/diffuseAlphaMaskIndexedF.glsl    |  7 +++-
 .../deferred/diffuseAlphaMaskNoColorF.glsl    | 25 ++++++++++--
 .../shaders/class1/deferred/diffuseF.glsl     | 10 +++--
 .../class1/deferred/diffuseIndexedF.glsl      | 10 +++--
 .../class1/deferred/diffuseNoColorV.glsl      | 13 ++++---
 .../class1/deferred/diffuseSkinnedV.glsl      | 16 ++++----
 .../shaders/class1/deferred/diffuseV.glsl     | 18 +++++----
 .../shaders/class1/deferred/emissiveF.glsl    | 24 +++++++++++-
 .../shaders/class1/deferred/emissiveV.glsl    | 17 ++++----
 .../shaders/class1/deferred/fullbrightF.glsl  |  5 ++-
 .../shaders/class1/deferred/fullbrightV.glsl  | 17 ++++----
 .../shaders/class1/deferred/giF.glsl          |  2 +-
 .../shaders/class1/deferred/giV.glsl          | 12 +++---
 .../shaders/class1/deferred/impostorF.glsl    |  8 ++--
 .../shaders/class1/deferred/impostorV.glsl    | 13 ++++---
 .../shaders/class1/deferred/luminanceF.glsl   |  2 +-
 .../shaders/class1/deferred/luminanceV.glsl   |  9 +++--
 .../class1/deferred/multiPointLightF.glsl     |  2 +-
 .../class1/deferred/multiPointLightV.glsl     |  4 +-
 .../class1/deferred/multiSpotLightF.glsl      |  2 +-
 .../shaders/class1/deferred/pointLightF.glsl  |  2 +-
 .../shaders/class1/deferred/pointLightV.glsl  |  4 +-
 .../class1/deferred/postDeferredF.glsl        |  4 +-
 .../class1/deferred/postDeferredNoDoFF.glsl   |  4 +-
 .../deferred/postDeferredNoDoFNoFXAAF.glsl    |  2 +-
 .../class1/deferred/postDeferredNoFXAAF.glsl  |  2 +-
 .../class1/deferred/postDeferredV.glsl        |  6 +--
 .../shaders/class1/deferred/postgiF.glsl      |  2 +-
 .../shaders/class1/deferred/postgiV.glsl      |  4 +-
 .../class1/deferred/shadowAlphaMaskF.glsl     |  6 ++-
 .../class1/deferred/shadowAlphaMaskV.glsl     | 14 ++++---
 .../shaders/class1/deferred/shadowF.glsl      |  2 +-
 .../shaders/class1/deferred/shadowV.glsl      |  4 +-
 .../shaders/class1/deferred/skyF.glsl         |  2 +-
 .../shaders/class1/deferred/skyV.glsl         |  9 +++--
 .../shaders/class1/deferred/softenLightF.glsl |  2 +-
 .../shaders/class1/deferred/softenLightV.glsl |  4 +-
 .../shaders/class1/deferred/spotLightF.glsl   |  2 +-
 .../shaders/class1/deferred/starsF.glsl       |  5 ++-
 .../shaders/class1/deferred/starsV.glsl       | 13 ++++---
 .../class1/deferred/sunLightSSAOF.glsl        |  2 +-
 .../shaders/class1/deferred/sunLightV.glsl    |  4 +-
 .../shaders/class1/deferred/terrainF.glsl     | 18 +++++----
 .../shaders/class1/deferred/terrainV.glsl     | 26 ++++++++-----
 .../shaders/class1/deferred/treeF.glsl        |  8 ++--
 .../shaders/class1/deferred/treeShadowF.glsl  | 25 ++++++++++--
 .../shaders/class1/deferred/treeShadowV.glsl  |  9 +++--
 .../shaders/class1/deferred/treeV.glsl        | 14 ++++---
 .../shaders/class1/deferred/waterF.glsl       |  8 ++--
 .../shaders/class1/deferred/waterV.glsl       | 10 ++---
 .../shaders/class1/effects/glowExtractF.glsl  |  4 +-
 .../class1/effects/glowExtractMSF.glsl        |  4 +-
 .../shaders/class1/effects/glowExtractV.glsl  |  7 ++--
 .../shaders/class1/effects/glowF.glsl         | 21 ++++++----
 .../shaders/class1/effects/glowV.glsl         | 25 +++++++-----
 .../shaders/class1/environment/terrainF.glsl  | 13 +++++--
 .../shaders/class1/environment/terrainV.glsl  | 34 +++++++++-------
 .../class1/environment/terrainWaterF.glsl     | 13 +++++--
 .../class1/environment/underWaterF.glsl       |  6 +--
 .../shaders/class1/environment/waterF.glsl    |  6 +--
 .../shaders/class1/environment/waterFogF.glsl |  7 ++--
 .../shaders/class1/environment/waterV.glsl    |  8 ++--
 .../class1/interface/customalphaF.glsl        |  5 ++-
 .../class1/interface/customalphaV.glsl        | 12 +++---
 .../shaders/class1/interface/debugV.glsl      |  2 +-
 .../class1/interface/glowcombineF.glsl        |  7 +++-
 .../class1/interface/glowcombineFXAAF.glsl    | 22 ++++++++++-
 .../class1/interface/glowcombineFXAAV.glsl    |  4 +-
 .../class1/interface/glowcombineV.glsl        | 13 ++++---
 .../shaders/class1/interface/highlightF.glsl  |  4 +-
 .../shaders/class1/interface/highlightV.glsl  |  8 ++--
 .../shaders/class1/interface/occlusionV.glsl  |  2 +-
 .../class1/interface/onetexturenocolorF.glsl  | 24 +++++++++++-
 .../class1/interface/onetexturenocolorV.glsl  |  7 ++--
 .../shaders/class1/interface/solidcolorF.glsl |  7 +++-
 .../shaders/class1/interface/solidcolorV.glsl | 13 ++++---
 .../class1/interface/splattexturerectF.glsl   |  5 ++-
 .../class1/interface/splattexturerectV.glsl   | 13 ++++---
 .../class1/interface/twotextureaddF.glsl      |  5 ++-
 .../class1/interface/twotextureaddV.glsl      | 13 ++++---
 .../shaders/class1/interface/uiF.glsl         |  5 ++-
 .../shaders/class1/interface/uiV.glsl         | 12 +++---
 .../shaders/class1/lighting/lightF.glsl       |  5 ++-
 .../class1/lighting/lightFullbrightF.glsl     |  4 +-
 .../lighting/lightFullbrightShinyF.glsl       |  4 +-
 .../lighting/lightFullbrightShinyWaterF.glsl  |  4 +-
 .../lighting/lightFullbrightWaterF.glsl       |  4 +-
 .../shaders/class1/lighting/lightShinyF.glsl  |  5 ++-
 .../class1/lighting/lightShinyWaterF.glsl     |  5 ++-
 .../shaders/class1/lighting/lightWaterF.glsl  |  5 ++-
 .../shaders/class1/objects/bumpF.glsl         |  7 +++-
 .../shaders/class1/objects/bumpV.glsl         | 13 ++++---
 .../class1/objects/emissiveSkinnedV.glsl      | 16 +++++---
 .../shaders/class1/objects/emissiveV.glsl     | 18 +++++----
 .../class1/objects/fullbrightNoColorV.glsl    | 16 +++++---
 .../objects/fullbrightShinySkinnedV.glsl      | 21 ++++++----
 .../class1/objects/fullbrightShinyV.glsl      | 21 ++++++----
 .../class1/objects/fullbrightSkinnedV.glsl    | 16 +++++---
 .../shaders/class1/objects/fullbrightV.glsl   | 16 +++++---
 .../shaders/class1/objects/impostorF.glsl     |  4 +-
 .../shaders/class1/objects/impostorV.glsl     |  8 ++--
 .../shaders/class1/objects/previewV.glsl      | 16 +++++---
 .../class1/objects/shinySimpleSkinnedV.glsl   | 18 +++++----
 .../shaders/class1/objects/shinyV.glsl        | 18 +++++----
 .../class1/objects/simpleNoColorV.glsl        | 16 +++++---
 .../class1/objects/simpleSkinnedV.glsl        | 18 +++++----
 .../shaders/class1/objects/simpleV.glsl       | 18 +++++----
 .../shaders/class1/objects/treeV.glsl         | 16 +++++---
 .../class1/windlight/atmosphericsVarsF.glsl   |  2 +-
 .../class1/windlight/atmosphericsVarsV.glsl   |  2 +-
 .../shaders/class2/avatar/eyeballV.glsl       | 18 +++++----
 .../shaders/class2/deferred/alphaF.glsl       | 19 +++++----
 .../class2/deferred/alphaNonIndexedF.glsl     | 18 +++++----
 .../deferred/alphaNonIndexedNoColorF.glsl     | 33 ++++++++++++----
 .../class2/deferred/alphaSkinnedV.glsl        | 28 +++++++------
 .../shaders/class2/deferred/alphaV.glsl       | 29 +++++++-------
 .../shaders/class2/deferred/avatarAlphaV.glsl | 25 ++++++------
 .../shaders/class2/deferred/edgeF.glsl        |  2 +-
 .../shaders/class2/deferred/edgeMSF.glsl      |  2 +-
 .../shaders/class2/deferred/edgeV.glsl        |  4 +-
 .../class2/deferred/multiSpotLightF.glsl      |  2 +-
 .../class2/deferred/multiSpotLightMSF.glsl    | 14 ++++---
 .../shaders/class2/deferred/softenLightF.glsl |  2 +-
 .../class2/deferred/softenLightMSF.glsl       |  4 +-
 .../shaders/class2/deferred/softenLightV.glsl |  4 +-
 .../shaders/class2/deferred/spotLightF.glsl   | 14 ++++---
 .../shaders/class2/deferred/spotLightMSF.glsl | 14 ++++---
 .../shaders/class2/deferred/sunLightF.glsl    | 12 +++---
 .../shaders/class2/deferred/sunLightMSF.glsl  | 14 +++----
 .../class2/deferred/sunLightSSAOF.glsl        | 12 +++---
 .../class2/deferred/sunLightSSAOMSF.glsl      | 14 +++----
 .../shaders/class2/deferred/sunLightV.glsl    |  4 +-
 .../shaders/class2/effects/blurF.glsl         | 26 +------------
 .../shaders/class2/effects/blurV.glsl         | 33 +---------------
 .../shaders/class2/effects/colorFilterF.glsl  |  2 +-
 .../shaders/class2/effects/drawQuadV.glsl     | 10 ++---
 .../shaders/class2/effects/extractF.glsl      |  2 +-
 .../shaders/class2/effects/nightVisionF.glsl  |  7 +++-
 .../shaders/class2/effects/simpleF.glsl       |  4 +-
 .../shaders/class2/environment/terrainF.glsl  | 19 +++++----
 .../shaders/class2/environment/terrainV.glsl  | 26 ++++++++-----
 .../class2/environment/terrainWaterF.glsl     | 20 +++++-----
 .../class2/environment/underWaterF.glsl       |  6 +--
 .../shaders/class2/environment/waterF.glsl    |  6 +--
 .../class2/lighting/lightAlphaMaskF.glsl      |  5 ++-
 .../lighting/lightAlphaMaskNonIndexedF.glsl   |  5 ++-
 .../shaders/class2/lighting/lightF.glsl       |  5 ++-
 .../lighting/lightFullbrightAlphaMaskF.glsl   |  5 ++-
 .../class2/lighting/lightFullbrightF.glsl     |  5 ++-
 .../lightFullbrightNonIndexedAlphaMaskF.glsl  |  5 ++-
 .../lighting/lightFullbrightNonIndexedF.glsl  |  5 ++-
 .../lighting/lightFullbrightShinyF.glsl       | 14 ++++---
 .../lightFullbrightShinyNonIndexedF.glsl      | 14 ++++---
 .../lighting/lightFullbrightShinyWaterF.glsl  | 14 ++++---
 .../lightFullbrightShinyWaterNonIndexedF.glsl | 14 ++++---
 .../lightFullbrightWaterAlphaMaskF.glsl       |  5 ++-
 .../lighting/lightFullbrightWaterF.glsl       |  5 ++-
 ...htFullbrightWaterNonIndexedAlphaMaskF.glsl |  5 ++-
 .../lightFullbrightWaterNonIndexedF.glsl      |  4 +-
 .../class2/lighting/lightNonIndexedF.glsl     |  5 ++-
 .../shaders/class2/lighting/lightShinyF.glsl  | 14 ++++---
 .../lighting/lightShinyNonIndexedF.glsl       | 15 +++----
 .../class2/lighting/lightShinyWaterF.glsl     | 14 ++++---
 .../lighting/lightShinyWaterNonIndexedF.glsl  | 14 ++++---
 .../class2/lighting/lightWaterAlphaMaskF.glsl |  5 ++-
 .../lightWaterAlphaMaskNonIndexedF.glsl       |  5 ++-
 .../shaders/class2/lighting/lightWaterF.glsl  |  4 +-
 .../lighting/lightWaterNonIndexedF.glsl       |  4 +-
 .../class2/objects/fullbrightShinyV.glsl      | 23 ++++++-----
 .../shaders/class2/objects/fullbrightV.glsl   | 19 +++++----
 .../shaders/class2/objects/shinyV.glsl        | 23 ++++++-----
 .../class2/objects/simpleNonIndexedV.glsl     | 18 +++++----
 .../shaders/class2/objects/simpleV.glsl       | 19 +++++----
 .../class2/windlight/atmosphericsV.glsl       |  6 +--
 .../class2/windlight/atmosphericsVarsF.glsl   | 10 ++---
 .../class2/windlight/atmosphericsVarsV.glsl   | 10 ++---
 .../shaders/class2/windlight/cloudsF.glsl     | 18 +++++----
 .../shaders/class2/windlight/cloudsV.glsl     | 34 +++++++++-------
 .../shaders/class2/windlight/skyF.glsl        |  2 +-
 .../shaders/class2/windlight/skyV.glsl        |  9 +++--
 .../shaders/class3/avatar/avatarV.glsl        | 17 ++++----
 .../class3/deferred/giDownsampleF.glsl        |  2 +-
 .../class3/deferred/giDownsampleV.glsl        |  4 +-
 .../shaders/class3/deferred/giF.glsl          |  2 +-
 .../shaders/class3/deferred/giFinalF.glsl     |  2 +-
 .../shaders/class3/deferred/giFinalV.glsl     |  4 +-
 .../shaders/class3/deferred/giV.glsl          | 11 +++---
 .../shaders/class3/deferred/luminanceF.glsl   |  2 +-
 .../shaders/class3/deferred/luminanceV.glsl   |  9 +++--
 .../class3/deferred/postDeferredF.glsl        |  2 +-
 .../class3/deferred/postDeferredV.glsl        |  4 +-
 .../shaders/class3/deferred/postgiF.glsl      |  2 +-
 .../shaders/class3/deferred/postgiV.glsl      |  4 +-
 .../shaders/class3/deferred/softenLightF.glsl |  4 +-
 .../shaders/class3/deferred/softenLightV.glsl |  8 ++--
 .../shaders/class3/deferred/treeF.glsl        |  8 ++--
 indra/newview/lldrawpoolterrain.cpp           | 11 +++---
 225 files changed, 1465 insertions(+), 975 deletions(-)

diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index db3d7becd90..889b436ac56 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -477,7 +477,7 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns)
 		}
 		else
 		{
-			LL_DEBUGS("ShaderLoading") << log << LL_ENDL;
+			LL_INFOS("ShaderLoading") << log << LL_ENDL;
 		}
 	}
  }
@@ -546,11 +546,39 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
 		text[count++] = strdup("#version 120\n");
 		text[count++] = strdup("#define FXAA_GLSL_120 1\n");
 		text[count++] = strdup("#define FXAA_FAST_PIXEL_OFFSET 0\n");
+		text[count++] = strdup("#define ATTRIBUTE attribute\n");
+		text[count++] = strdup("#define VARYING varying\n");
 	}
 	else
-	{  //set version to 1.30
-		text[count++] = strdup("#version 130\n");
+	{  
+		if (gGLManager.mGLVersion < 4.f)
+		{
+			//set version to 1.30
+			text[count++] = strdup("#version 130\n");
+		}
+		else
+		{ //set version to 400
+			text[count++] = strdup("#version 400\n");
+		}
+
 		text[count++] = strdup("#define FXAA_GLSL_130 1\n");
+
+		text[count++] = strdup("#define ATTRIBUTE in\n");
+
+		if (type == GL_VERTEX_SHADER_ARB)
+		{ //"varying" state is "out" in a vertex program, "in" in a fragment program 
+			// ("varying" is deprecated after version 1.20)
+			text[count++] = strdup("#define VARYING out\n");
+		}
+		else
+		{
+			text[count++] = strdup("#define VARYING in\n");
+		}
+
+		//backwards compatibility with legacy texture lookup syntax
+		text[count++] = strdup("#define textureCube texture\n");
+		text[count++] = strdup("#define texture2DLod textureLod\n");
+		text[count++] = strdup("#define	shadow2D texture\n");
 	}
 
 	//copy preprocessor definitions into buffer
@@ -574,7 +602,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
 		.
 		uniform sampler2D texN;
 		
-		varying float vary_texture_index;
+		VARYING float vary_texture_index;
 
 		vec4 diffuseLookup(vec2 texcoord)
 		{
@@ -600,7 +628,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
 			text[count++] = strdup(decl.c_str());
 		}
 
-		text[count++] = strdup("varying float vary_texture_index;\n");
+		text[count++] = strdup("VARYING float vary_texture_index;\n");
 		text[count++] = strdup("vec4 diffuseLookup(vec2 texcoord)\n");
 		text[count++] = strdup("{\n");
 		
@@ -716,6 +744,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
 
 					if (i % 128 == 0)
 					{ //dump every 128 lines
+
 						LL_WARNS("ShaderLoading") << "\n" << ostr.str() << llendl;
 						ostr = std::stringstream();
 					}
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
index dca96910f20..bc63d07d726 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl
@@ -24,7 +24,7 @@
  */
  
 
-attribute vec4 weight;
+ATTRIBUTE vec4 weight;
 
 uniform vec4 matrixPalette[45];
 
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
index c98b99b15ac..cf939e2df8e 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl
@@ -25,9 +25,13 @@
 
 uniform mat4 projection_matrix;
 
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 mat4 getSkinnedTransform();
@@ -35,7 +39,7 @@ void calcAtmospherics(vec3 inPositionEye);
 
 void main()
 {
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
+	vary_texcoord0 = texcoord0;
 				
 	vec4 pos;
 	vec3 norm;
@@ -55,12 +59,12 @@ void main()
 		
 	gl_Position = projection_matrix * pos;
 	
-	gl_FogFragCoord = length(pos.xyz);
+	fog_depth = length(pos.xyz);
 
 	calcAtmospherics(pos.xyz);
 
 	vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0,0,0,0));
-	gl_FrontColor = color; 
+	vertex_color = color; 
 
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
index 9a19fb928bd..82db15c3aeb 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl
@@ -28,10 +28,13 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec4 diffuse_color;
-attribute vec3 normal;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
@@ -41,7 +44,7 @@ void main()
 	//transform vertex
 	vec3 pos = (modelview_matrix * vec4(position.xyz, 1.0)).xyz;
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	
 	vec3 norm = normalize(normal_matrix * normal);
@@ -50,7 +53,7 @@ void main()
 
 	vec4 specular = vec4(1.0);
 	vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0));	
-	gl_FrontColor = color;
+	vertex_color = color;
 
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
index 6fef303723a..43ed41a2050 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl
@@ -24,7 +24,7 @@
 
 
 
-attribute vec4 weight4;  
+ATTRIBUTE vec4 weight4;  
 
 uniform mat4 matrixPalette[32];
 
diff --git a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl
index 374808c0911..a64f6ea55ce 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl
@@ -23,11 +23,12 @@
  * $/LicenseInfo$
  */
  
-
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 uniform sampler2D diffuseMap;
 
 void main() 
 {
-	gl_FragColor = vec4(gl_Color.rgb, texture2D(diffuseMap, gl_TexCoord[0].xy).a);
+	gl_FragColor = vec4(vertex_color.rgb, texture2D(diffuseMap, vary_texcoord0.xy).a);
 }
diff --git a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl
index 21a9e91bf51..78b5328c9a3 100644
--- a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl
+++ b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl
@@ -25,9 +25,12 @@
 
 uniform mat4 projection_matrix;
 
-attribute vec3 position;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 mat4 getSkinnedTransform();
 
@@ -41,7 +44,7 @@ void main()
 	pos.z = dot(trans[2], pos_in);
 	pos.w = 1.0;
 			
-	gl_FrontColor = diffuse_color;
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
+	vertex_color = diffuse_color;
+	vary_texcoord0 = texcoord0;
 	gl_Position = projection_matrix * pos;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 19de0c0b39f..23142a3516d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -38,11 +38,14 @@ uniform vec2 screen_res;
 vec3 atmosLighting(vec3 light);
 vec3 scaleSoftClip(vec3 light);
 
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_fragcoord;
-varying vec3 vary_position;
-varying vec3 vary_pointlight_col;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_position;
+VARYING vec3 vary_pointlight_col;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 uniform mat4 inv_proj;
 
@@ -66,9 +69,9 @@ void main()
 	
 	vec4 pos = vec4(vary_position, 1.0);
 	
-	vec4 diff= diffuseLookup(gl_TexCoord[0].xy);
+	vec4 diff= diffuseLookup(vary_texcoord0.xy);
 
-	vec4 col = vec4(vary_ambient + vary_directional.rgb, gl_Color.a);
+	vec4 col = vec4(vary_ambient + vary_directional.rgb, vertex_color.a);
 	vec4 color = diff * col;
 	
 	color.rgb = atmosLighting(color.rgb);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl
index d4f56896cfa..332bc9c262e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl
@@ -38,11 +38,13 @@ uniform vec2 screen_res;
 vec3 atmosLighting(vec3 light);
 vec3 scaleSoftClip(vec3 light);
 
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_fragcoord;
-varying vec3 vary_position;
-varying vec3 vary_pointlight_col;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_position;
+VARYING vec3 vary_pointlight_col;
+VARYING vec2 vary_texcoord0;
+VARYING vec4 vertex_color;
 
 uniform mat4 inv_proj;
 
@@ -66,9 +68,9 @@ void main()
 	
 	vec4 pos = vec4(vary_position, 1.0);
 	
-	vec4 diff= texture2D(diffuseMap,gl_TexCoord[0].xy);
+	vec4 diff= texture2D(diffuseMap,vary_texcoord0.xy);
 
-	vec4 col = vec4(vary_ambient + vary_directional.rgb, gl_Color.a);
+	vec4 col = vec4(vary_ambient + vary_directional.rgb, vertex_color.a);
 	vec4 color = diff * col;
 	
 	color.rgb = atmosLighting(color.rgb);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl
index 5d1306bfc92..e8a2318f397 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl
@@ -1,7 +1,25 @@
 /** 
  * @file alphaNonIndexedNoColorF.glsl
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2005&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2005, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
  
@@ -19,11 +37,12 @@ uniform vec2 screen_res;
 vec3 atmosLighting(vec3 light);
 vec3 scaleSoftClip(vec3 light);
 
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_fragcoord;
-varying vec3 vary_position;
-varying vec3 vary_pointlight_col;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_position;
+VARYING vec3 vary_pointlight_col;
+VARYING vec2 vary_texcoord0;
 
 uniform mat4 inv_proj;
 
@@ -47,7 +66,7 @@ void main()
 	
 	vec4 pos = vec4(vary_position, 1.0);
 	
-	vec4 diff= texture2D(diffuseMap,gl_TexCoord[0].xy);
+	vec4 diff= texture2D(diffuseMap,vary_texcoord0.xy);
 
 	vec4 col = vec4(vary_ambient + vary_directional.rgb, 1.0);
 	vec4 color = diff * col;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
index 9d2c009d2af..e5899872db2 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
@@ -25,10 +25,10 @@
 uniform mat4 projection_matrix;
 uniform mat4 modelview_matrix;
 
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 mat4 getObjectSkinnedTransform();
@@ -41,12 +41,15 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
 vec3 scaleDownLight(vec3 light);
 vec3 scaleUpLight(vec3 light);
 
-varying vec3 vary_position;
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_normal;
-varying vec3 vary_fragcoord;
-varying vec3 vary_pointlight_col;
+VARYING vec3 vary_position;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_normal;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_pointlight_col;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
 
 uniform float near_clip;
 
@@ -87,7 +90,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
 
 void main()
 {
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
+	vary_texcoord0 = texcoord0;
 				
 	vec4 pos;
 	vec3 norm;
@@ -130,9 +133,9 @@ void main()
 	
 	col.rgb = min(col.rgb*diffuse_color.rgb, 1.0);
 	
-	gl_FrontColor = col;
+	vertex_color = col;
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 	
 	vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
index 490ac7c0676..9920caf7f66 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl
@@ -28,10 +28,10 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec4 position;
-attribute vec3 normal;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec4 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
@@ -43,13 +43,16 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
 vec3 scaleDownLight(vec3 light);
 vec3 scaleUpLight(vec3 light);
 
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_fragcoord;
-varying vec3 vary_position;
-varying vec3 vary_light;
-varying vec3 vary_pointlight_col;
-varying float vary_texture_index;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_position;
+VARYING vec3 vary_light;
+VARYING vec3 vary_pointlight_col;
+VARYING float vary_texture_index;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
 
 uniform float near_clip;
 uniform float shadow_offset;
@@ -98,7 +101,7 @@ void main()
 	vec4 pos = (modelview_matrix * vert);
 	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
 	
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	vec3 norm = normalize(normal_matrix * normal);
 	
@@ -132,9 +135,9 @@ void main()
 	
 	col.rgb = col.rgb*diffuse_color.rgb;
 	
-	gl_FrontColor = col;
+	vertex_color = col;
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 	
 	pos = modelview_projection_matrix * vert;
 	vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl
index 0c930848e58..40fa59b6375 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl
@@ -26,10 +26,12 @@
 
 uniform sampler2D diffuseMap;
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main() 
 {
-	//gl_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy).a);
+	//gl_FragColor = vec4(1,1,1,vertex_color.a * texture2D(diffuseMap, vary_texcoord0.xy).a);
 	gl_FragColor = vec4(1,1,1,1);
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl
index fc055e555d2..533babf3dc2 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl
@@ -26,23 +26,26 @@ uniform mat4 projection_matrix;
 uniform mat4 modelview_matrix;
 uniform mat4 texture_matrix0;
 
-attribute vec3 position;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 mat4 getObjectSkinnedTransform();
 
 void main()
 {
 	//transform vertex
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	mat4 mat = getObjectSkinnedTransform();
 	
 	mat = modelview_matrix * mat;
 	vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;
 	
-	gl_FrontColor = diffuse_color;
+	vertex_color = diffuse_color;
 	
 	vec4 p = projection_matrix * vec4(pos, 1.0);
 	p.z = max(p.z, -p.w+0.01);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl
index 16f2b889f8a..12e88ca5dd6 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl
@@ -25,9 +25,9 @@
 
 uniform mat4 projection_matrix;
 
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 mat4 getSkinnedTransform();
@@ -41,11 +41,14 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
 vec3 scaleDownLight(vec3 light);
 vec3 scaleUpLight(vec3 light);
 
-varying vec3 vary_position;
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_fragcoord;
-varying vec3 vary_pointlight_col;
+VARYING vec3 vary_position;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_pointlight_col;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
 
 uniform float near_clip;
 
@@ -86,7 +89,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
 
 void main()
 {
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
+	vary_texcoord0 = texcoord0;
 				
 	vec4 pos;
 	vec3 norm;
@@ -132,9 +135,9 @@ void main()
 	
 	col.rgb = min(col.rgb, 1.0);
 	
-	gl_FrontColor = col;
+	vertex_color = col;
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 	
 	vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
index d5c20a22d93..01ffb862f70 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl
@@ -27,20 +27,22 @@ uniform mat3 normal_matrix;
 uniform mat4 texture_matrix0;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
 
-varying vec3 vary_normal;
+VARYING vec3 vary_normal;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	//transform vertex
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); 
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	vary_normal = normalize(normal_matrix * normal);
 
-	gl_FrontColor = diffuse_color;
+	vertex_color = diffuse_color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
index a006b81ef76..b1fc9da8557 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl
@@ -27,11 +27,12 @@
 
 uniform sampler2D diffuseMap;
 
-varying vec3 vary_normal;
+VARYING vec3 vary_normal;
+VARYING vec2 vary_texcoord0;
 
 void main() 
 {
-	vec4 diff = texture2D(diffuseMap, gl_TexCoord[0].xy);
+	vec4 diff = texture2D(diffuseMap, vary_texcoord0.xy);
 	
 	if (diff.a < 0.2)
 	{
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl
index ba3cc82b399..c9386062c6a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl
@@ -27,7 +27,7 @@
 
 uniform sampler2D diffuseMap;
 
-varying vec4 post_pos;
+VARYING vec4 post_pos;
 
 void main() 
 {
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
index 6835b9c0214..525acbe4ea9 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl
@@ -27,15 +27,16 @@ uniform mat4 projection_matrix;
 
 mat4 getSkinnedTransform();
 
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
 
-varying vec4 post_pos;
+VARYING vec4 post_pos;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
+	vary_texcoord0 = texcoord0;
 				
 	vec4 pos;
 	vec3 norm;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
index 704845d310a..1bd8fee7c97 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl
@@ -25,19 +25,20 @@
  
 uniform mat4 projection_matrix;
 
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
 
 mat4 getSkinnedTransform();
 
-attribute vec4 weight;
+ATTRIBUTE vec4 weight;
 
-varying vec3 vary_normal;
+VARYING vec3 vary_normal;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
+	vary_texcoord0 = texcoord0;
 				
 	vec4 pos;
 	vec3 norm;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
index 3609cc054b9..e0a25b505a3 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl
@@ -37,7 +37,7 @@ uniform vec2 delta;
 uniform vec3 kern[4];
 uniform float kern_scale;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 uniform mat4 inv_proj;
 uniform vec2 screen_res;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl
index 5339e380181..212f7e56adf 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl
@@ -25,9 +25,9 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
+ATTRIBUTE vec3 position;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 uniform vec2 screen_res;
 
 void main()
diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl
index 429a891f073..379420a8a00 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl
@@ -28,22 +28,25 @@
 uniform sampler2D diffuseMap;
 uniform sampler2D bumpMap;
 
-varying vec3 vary_mat0;
-varying vec3 vary_mat1;
-varying vec3 vary_mat2;
+VARYING vec3 vary_mat0;
+VARYING vec3 vary_mat1;
+VARYING vec3 vary_mat2;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main() 
 {
-	vec3 col = gl_Color.rgb * texture2D(diffuseMap, gl_TexCoord[0].xy).rgb;
-	vec3 norm = texture2D(bumpMap, gl_TexCoord[0].xy).rgb * 2.0 - 1.0;
+	vec3 col = vertex_color.rgb * texture2D(diffuseMap, vary_texcoord0.xy).rgb;
+	vec3 norm = texture2D(bumpMap, vary_texcoord0.xy).rgb * 2.0 - 1.0;
 
 	vec3 tnorm = vec3(dot(norm,vary_mat0),
 			  dot(norm,vary_mat1),
 			  dot(norm,vary_mat2));
 						
 	gl_FragData[0] = vec4(col, 0.0);
-	gl_FragData[1] = gl_Color.aaaa; // spec
-	//gl_FragData[1] = vec4(vec3(gl_Color.a), gl_Color.a+(1.0-gl_Color.a)*gl_Color.a); // spec - from former class3 - maybe better, but not so well tested
+	gl_FragData[1] = vertex_color.aaaa; // spec
+	//gl_FragData[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
 	vec3 nvn = normalize(tnorm);
 	gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl
index cf93430217e..6c205074b4e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl
@@ -26,21 +26,23 @@ uniform mat4 projection_matrix;
 uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 
-attribute vec3 position;
-attribute vec4 diffuse_color;
-attribute vec3 normal;
-attribute vec2 texcoord0;
-attribute vec2 texcoord2;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec2 texcoord2;
 
-varying vec3 vary_mat0;
-varying vec3 vary_mat1;
-varying vec3 vary_mat2;
+VARYING vec3 vary_mat0;
+VARYING vec3 vary_mat1;
+VARYING vec3 vary_mat2;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 mat4 getObjectSkinnedTransform();
 
 void main()
 {
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	mat4 mat = getObjectSkinnedTransform();
 	
@@ -58,5 +60,5 @@ void main()
 	vary_mat2 = vec3(t.z, b.z, n.z);
 	
 	gl_Position = projection_matrix*vec4(pos, 1.0);
-	gl_FrontColor = diffuse_color;
+	vertex_color = diffuse_color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl
index 9ec31383acf..c8d38bb8f74 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl
@@ -27,21 +27,23 @@ uniform mat3 normal_matrix;
 uniform mat4 texture_matrix0;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec4 diffuse_color;
-attribute vec3 normal;
-attribute vec2 texcoord0;
-attribute vec3 binormal;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec3 binormal;
 
-varying vec3 vary_mat0;
-varying vec3 vary_mat1;
-varying vec3 vary_mat2;
+VARYING vec3 vary_mat0;
+VARYING vec3 vary_mat1;
+VARYING vec3 vary_mat2;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	//transform vertex
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); 
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	vec3 n = normalize(normal_matrix * normal);
 	vec3 b = normalize(normal_matrix * binormal);
@@ -51,5 +53,5 @@ void main()
 	vary_mat1 = vec3(t.y, b.y, n.y);
 	vary_mat2 = vec3(t.z, b.z, n.z);
 	
-	gl_FrontColor = diffuse_color;
+	vertex_color = diffuse_color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
index f4310dae958..127136a12c2 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl
@@ -29,15 +29,20 @@
 // The fragment shader for the sky
 /////////////////////////////////////////////////////////////////////////
 
-varying vec4 vary_CloudColorSun;
-varying vec4 vary_CloudColorAmbient;
-varying float vary_CloudDensity;
+VARYING vec4 vary_CloudColorSun;
+VARYING vec4 vary_CloudColorAmbient;
+VARYING float vary_CloudDensity;
 
 uniform sampler2D cloud_noise_texture;
 uniform vec4 cloud_pos_density1;
 uniform vec4 cloud_pos_density2;
 uniform vec4 gamma;
 
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
+VARYING vec2 vary_texcoord2;
+VARYING vec2 vary_texcoord3;
+
 /// Soft clips the light with a gamma correction
 vec3 scaleSoftClip(vec3 light) {
 	//soft clip effect:
@@ -50,14 +55,14 @@ vec3 scaleSoftClip(vec3 light) {
 void main()
 {
 	// Set variables
-	vec2 uv1 = gl_TexCoord[0].xy;
-	vec2 uv2 = gl_TexCoord[1].xy;
+	vec2 uv1 = vary_texcoord0.xy;
+	vec2 uv2 = vary_texcoord1.xy;
 
 	vec4 cloudColorSun = vary_CloudColorSun;
 	vec4 cloudColorAmbient = vary_CloudColorAmbient;
 	float cloudDensity = vary_CloudDensity;
-	vec2 uv3 = gl_TexCoord[2].xy;
-	vec2 uv4 = gl_TexCoord[3].xy;
+	vec2 uv3 = vary_texcoord2.xy;
+	vec2 uv4 = vary_texcoord3.xy;
 
 	// Offset texture coords
 	uv1 += cloud_pos_density1.xy;	//large texture, visible density
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
index 67b5e7fb837..64e094e3c5b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
@@ -25,17 +25,22 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
 
 //////////////////////////////////////////////////////////////////////////
 // The vertex shader for creating the atmospheric sky
 ///////////////////////////////////////////////////////////////////////////////
 
 // Output parameters
-varying vec4 vary_CloudColorSun;
-varying vec4 vary_CloudColorAmbient;
-varying float vary_CloudDensity;
+VARYING vec4 vary_CloudColorSun;
+VARYING vec4 vary_CloudColorAmbient;
+VARYING float vary_CloudDensity;
+
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
+VARYING vec2 vary_texcoord2;
+VARYING vec2 vary_texcoord3;
 
 // Inputs
 uniform vec3 camPosLocal;
@@ -64,7 +69,7 @@ void main()
 	// World / view / projection
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
 
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
+	vary_texcoord0 = texcoord0;
 
 	// Get relative position
 	vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
@@ -163,17 +168,17 @@ void main()
 
 
 	// Texture coords
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
-	gl_TexCoord[0].xy -= 0.5;
-	gl_TexCoord[0].xy /= cloud_scale.x;
-	gl_TexCoord[0].xy += 0.5;
+	vary_texcoord0 = texcoord0;
+	vary_texcoord0.xy -= 0.5;
+	vary_texcoord0.xy /= cloud_scale.x;
+	vary_texcoord0.xy += 0.5;
 
-	gl_TexCoord[1] = gl_TexCoord[0];
-	gl_TexCoord[1].x += lightnorm.x * 0.0125;
-	gl_TexCoord[1].y += lightnorm.z * 0.0125;
+	vary_texcoord1 = vary_texcoord0;
+	vary_texcoord1.x += lightnorm.x * 0.0125;
+	vary_texcoord1.y += lightnorm.z * 0.0125;
 
-	gl_TexCoord[2] = gl_TexCoord[0] * 16.;
-	gl_TexCoord[3] = gl_TexCoord[1] * 16.;
+	vary_texcoord2 = vary_texcoord0 * 16.;
+	vary_texcoord3 = vary_texcoord1 * 16.;
 
 	// Combine these to minimize register use
 	vary_CloudColorAmbient += oHazeColorBelowCloud;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
index e1dc1de0aff..51d67d2790e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl
@@ -29,11 +29,13 @@ uniform float maximum_alpha;
 
 uniform sampler2D diffuseMap;
 
-varying vec3 vary_normal;
+VARYING vec3 vary_normal;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main() 
 {
-	vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color;
+	vec4 col = texture2D(diffuseMap, vary_texcoord0.xy) * vertex_color;
 	
 	if (col.a < minimum_alpha || col.a > maximum_alpha)
 	{
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl
index f3ad6f92de5..8868d33705f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl
@@ -23,14 +23,17 @@
  * $/LicenseInfo$
  */
  
-varying vec3 vary_normal;
+VARYING vec3 vary_normal;
 
 uniform float minimum_alpha;
 uniform float maximum_alpha;
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void main() 
 {
-	vec4 col = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
+	vec4 col = diffuseLookup(vary_texcoord0.xy) * vertex_color;
 	
 	if (col.a < minimum_alpha || col.a > maximum_alpha)
 	{
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl
index dfc1b52c2e7..2f46d43b9d5 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl
@@ -1,7 +1,25 @@
 /** 
  * @file diffuseAlphaMaskNoColorF.glsl
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2005&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2005, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
  
@@ -11,11 +29,12 @@ uniform float maximum_alpha;
 
 uniform sampler2D diffuseMap;
 
-varying vec3 vary_normal;
+VARYING vec3 vary_normal;
+VARYING vec2 vary_texcoord0;
 
 void main() 
 {
-	vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy);
+	vec4 col = texture2D(diffuseMap, vary_texcoord0.xy);
 	
 	if (col.a < minimum_alpha || col.a > maximum_alpha)
 	{
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl
index 9c9a8b56c59..aaf89a22ef4 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl
@@ -27,14 +27,16 @@
 
 uniform sampler2D diffuseMap;
 
-varying vec3 vary_normal;
+VARYING vec3 vary_normal;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main() 
 {
-	vec3 col = gl_Color.rgb * texture2D(diffuseMap, gl_TexCoord[0].xy).rgb;
+	vec3 col = vertex_color.rgb * texture2D(diffuseMap, vary_texcoord0.xy).rgb;
 	gl_FragData[0] = vec4(col, 0.0);
-	gl_FragData[1] = gl_Color.aaaa; // spec
-	//gl_FragData[1] = vec4(vec3(gl_Color.a), gl_Color.a+(1.0-gl_Color.a)*gl_Color.a); // spec - from former class3 - maybe better, but not so well tested
+	gl_FragData[1] = vertex_color.aaaa; // spec
+	//gl_FragData[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
 	vec3 nvn = normalize(vary_normal);
 	gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl
index 4d996a099dc..e08e52c7cfe 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl
@@ -23,15 +23,17 @@
  * $/LicenseInfo$
  */
  
-varying vec3 vary_normal;
+VARYING vec3 vary_normal;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main() 
 {
-	vec3 col = gl_Color.rgb * diffuseLookup(gl_TexCoord[0].xy).rgb;
+	vec3 col = vertex_color.rgb * diffuseLookup(vary_texcoord0.xy).rgb;
 
 	gl_FragData[0] = vec4(col, 0.0);
-	gl_FragData[1] = gl_Color.aaaa; // spec
-	//gl_FragData[1] = vec4(vec3(gl_Color.a), gl_Color.a+(1.0-gl_Color.a)*gl_Color.a); // spec - from former class3 - maybe better, but not so well tested
+	gl_FragData[1] = vertex_color.aaaa; // spec
+	//gl_FragData[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
 	vec3 nvn = normalize(vary_normal);
 	gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl
index 37864578ecd..7ed41cbcb91 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl
@@ -27,18 +27,19 @@ uniform mat3 normal_matrix;
 uniform mat4 texture_matrix0;
 uniform mat4 modelview_projection_matrix; 
 
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
 
-varying vec3 vary_normal;
-varying float vary_texture_index;
+VARYING vec3 vary_normal;
+VARYING float vary_texture_index;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	//transform vertex
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); 
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	vary_normal = normalize(normal_matrix * normal);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl
index 880a7ea0a29..a74290bfcd0 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl
@@ -26,18 +26,20 @@ uniform mat4 projection_matrix;
 uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 
-attribute vec3 position;
-attribute vec4 diffuse_color;
-attribute vec3 normal;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
 
-varying vec3 vary_normal;
+VARYING vec3 vary_normal;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 mat4 getObjectSkinnedTransform();
 
 void main()
 {
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	mat4 mat = getObjectSkinnedTransform();
 	
@@ -51,7 +53,7 @@ void main()
 
 	vary_normal = norm.xyz;
 			
-	gl_FrontColor = diffuse_color;
+	vertex_color = diffuse_color;
 	
 	gl_Position = projection_matrix*vec4(pos, 1.0);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl
index e158df13f70..36000b86d66 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl
@@ -27,22 +27,24 @@ uniform mat3 normal_matrix;
 uniform mat4 texture_matrix0;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec4 position;
-attribute vec4 diffuse_color;
-attribute vec3 normal;
-attribute vec2 texcoord0;
+ATTRIBUTE vec4 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
 
-varying vec3 vary_normal;
-varying float vary_texture_index;
+VARYING vec3 vary_normal;
+VARYING float vary_texture_index;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	//transform vertex
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); 
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	vary_texture_index = position.w;
 	vary_normal = normalize(normal_matrix * normal);
 
-	gl_FrontColor = diffuse_color;
+	vertex_color = diffuse_color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
index 5a9a6196f38..6cf563189a0 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
@@ -1,7 +1,25 @@
 /** 
  * @file emissiveF.glsl
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2005&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2005, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
  
@@ -12,12 +30,14 @@
 vec3 fullbrightAtmosTransport(vec3 light);
 vec3 fullbrightScaleSoftClip(vec3 light);
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main() 
 {
 	float shadow = 1.0;
 
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy)*gl_Color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy)*vertex_color;
 	
 	color.rgb = fullbrightAtmosTransport(color.rgb);
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl
index fccf8554d21..b3558be6787 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl
@@ -27,9 +27,9 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec4 position;
-attribute float emissive;
-attribute vec2 texcoord0;
+ATTRIBUTE vec4 position;
+ATTRIBUTE float emissive;
+ATTRIBUTE vec2 texcoord0;
 
 void calcAtmospherics(vec3 inPositionEye);
 
@@ -38,7 +38,10 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
 vec3 scaleDownLight(vec3 light);
 vec3 scaleUpLight(vec3 light);
 
-varying float vary_texture_index;
+VARYING float vary_texture_index;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
 
 void main()
 {
@@ -49,11 +52,11 @@ void main()
 
 	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
 	
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	calcAtmospherics(pos.xyz);
 	
-	gl_FrontColor = vec4(0,0,0,emissive);
+	vertex_color = vec4(0,0,0,emissive);
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
index 6c506676afd..f54827f7208 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
@@ -27,6 +27,9 @@
 
 #extension GL_ARB_texture_rectangle : enable
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 vec3 fullbrightAtmosTransport(vec3 light);
 vec3 fullbrightScaleSoftClip(vec3 light);
 
@@ -35,7 +38,7 @@ void main()
 {
 	float shadow = 1.0;
 
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy)*gl_Color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy)*vertex_color;
 	
 	color.rgb = fullbrightAtmosTransport(color.rgb);
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl
index 27591654719..ef9f62da847 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl
@@ -28,9 +28,9 @@ uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
 
-attribute vec4 position;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec4 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
 
 void calcAtmospherics(vec3 inPositionEye);
 
@@ -39,7 +39,10 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
 vec3 scaleDownLight(vec3 light);
 vec3 scaleUpLight(vec3 light);
 
-varying float vary_texture_index;
+VARYING float vary_texture_index;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
 
 void main()
 {
@@ -50,11 +53,11 @@ void main()
 
 	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
 	
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	calcAtmospherics(pos.xyz);
 	
-	gl_FrontColor = diffuse_color;
+	vertex_color = diffuse_color;
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/giF.glsl b/indra/newview/app_settings/shaders/class1/deferred/giF.glsl
index bfb7760af82..72c5a930873 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/giF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/giF.glsl
@@ -38,7 +38,7 @@ uniform sampler2D		depthGIMap;
 uniform sampler2D		lightFunc;
 
 // Inputs
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 uniform vec2 screen_res;
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl b/indra/newview/app_settings/shaders/class1/deferred/giV.glsl
index 2766691bd02..e5d3bb8ea61 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/giV.glsl
@@ -25,12 +25,12 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
 
-
-varying vec2 vary_fragcoord;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_fragcoord;
 
 uniform vec2 screen_res;
 
@@ -44,5 +44,5 @@ void main()
 	vec4 tex = vec4(texcoord0,0,1);
 	tex.w = 1.0;
 
-	gl_FrontColor = diffuse_color;
+	vertex_color = diffuse_color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
index 7152e13946f..e98f9aef878 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
@@ -31,9 +31,11 @@ uniform sampler2D diffuseMap;
 uniform sampler2D normalMap;
 uniform sampler2D specularMap;
 
+VARYING vec2 vary_texcoord0;
+
 void main() 
 {
-	vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy);
+	vec4 col = texture2D(diffuseMap, vary_texcoord0.xy);
 
 	if (col.a < minimum_alpha || col.a > maximum_alpha)
 	{
@@ -41,6 +43,6 @@ void main()
 	}
 
 	gl_FragData[0] = vec4(col.rgb, col.a * 0.005);
-	gl_FragData[1] = texture2D(specularMap, gl_TexCoord[0].xy);
-	gl_FragData[2] = vec4(texture2D(normalMap, gl_TexCoord[0].xy).xyz, 0.0);
+	gl_FragData[1] = texture2D(specularMap, vary_texcoord0.xy);
+	gl_FragData[2] = vec4(texture2D(normalMap, vary_texcoord0.xy).xyz, 0.0);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl
index 645b0d793a7..58e5dc0b569 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl
@@ -26,15 +26,18 @@
 uniform mat4 texture_matrix0;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	//transform vertex
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); 
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
-	gl_FrontColor = diffuse_color;
+	vertex_color = diffuse_color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl
index 4ba26fb0c6e..4f13167c1c2 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl
@@ -27,7 +27,7 @@
 
 uniform sampler2DRect diffuseMap;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 void main() 
 {
diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl
index dafc55a6ff5..f2dc60aa5d2 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl
@@ -25,10 +25,11 @@
 
 uniform mat4 modelview_projection_matrix;
  
-attribute vec3 position;
-attribute vec4 diffuse_color;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
+VARYING vec4 vertex_color;
 
 uniform vec2 screen_res;
 
@@ -40,5 +41,5 @@ void main()
 	
 	vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;	
 
-	gl_FrontColor = diffuse_color;
+	vertex_color = diffuse_color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
index 42212a978ea..279a2fa78dd 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
@@ -45,7 +45,7 @@ uniform int light_count;
 uniform vec4 light[MAX_LIGHT_COUNT];
 uniform vec4 light_col[MAX_LIGHT_COUNT];
 
-varying vec4 vary_fragcoord;
+VARYING vec4 vary_fragcoord;
 uniform vec2 screen_res;
 
 uniform float far_z;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl
index 1d54d7bede0..eefefa640de 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl
@@ -25,9 +25,9 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
+ATTRIBUTE vec3 position;
 
-varying vec4 vary_fragcoord;
+VARYING vec4 vary_fragcoord;
 
 void main()
 {
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
index c42935d8153..dff63607263 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
@@ -60,7 +60,7 @@ uniform vec3 color;
 uniform float falloff;
 uniform float size;
 
-varying vec4 vary_fragcoord;
+VARYING vec4 vary_fragcoord;
 uniform vec2 screen_res;
 
 uniform mat4 inv_proj;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
index 8c34a554c2e..0fc23fecb41 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
@@ -43,7 +43,7 @@ uniform vec3 color;
 uniform float falloff;
 uniform float size;
 
-varying vec4 vary_fragcoord;
+VARYING vec4 vary_fragcoord;
 uniform vec2 screen_res;
 
 uniform mat4 inv_proj;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
index cab98175834..cb14e6d4e8b 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
@@ -25,9 +25,9 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
+ATTRIBUTE vec3 position;
 
-varying vec4 vary_fragcoord;
+VARYING vec4 vary_fragcoord;
 
 void main()
 {
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
index daef6a938c9..64044590c9c 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
@@ -2096,8 +2096,8 @@ uniform float magnification;
 
 uniform mat4 inv_proj;
 
-varying vec2 vary_fragcoord;
-varying vec2 vary_tc;
+VARYING vec2 vary_fragcoord;
+VARYING vec2 vary_tc;
 
 
 float getDepth(vec2 pos_screen)
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
index f67615bdd5b..16b61897d56 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
@@ -2083,8 +2083,8 @@ uniform vec2 rcp_screen_res;
 uniform vec4 rcp_frame_opt;
 uniform vec4 rcp_frame_opt2;
 uniform vec2 screen_res;
-varying vec2 vary_fragcoord;
-varying vec2 vary_tc;
+VARYING vec2 vary_fragcoord;
+VARYING vec2 vary_tc;
 
 void main() 
 {
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFNoFXAAF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFNoFXAAF.glsl
index b519dbc4b06..a1986fca9a6 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFNoFXAAF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFNoFXAAF.glsl
@@ -29,7 +29,7 @@ uniform sampler2DRect diffuseRect;
 uniform sampler2D bloomMap;
 
 uniform vec2 screen_res;
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 void main() 
 {
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoFXAAF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoFXAAF.glsl
index 861bb9f7358..84c23c97a02 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoFXAAF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoFXAAF.glsl
@@ -41,7 +41,7 @@ uniform float magnification;
 uniform mat4 inv_proj;
 uniform vec2 screen_res;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 float getDepth(vec2 pos_screen)
 {
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl
index b11f26fbae3..8edf5b2723f 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl
@@ -25,10 +25,10 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
+ATTRIBUTE vec3 position;
 
-varying vec2 vary_fragcoord;
-varying vec2 vary_tc;
+VARYING vec2 vary_fragcoord;
+VARYING vec2 vary_tc;
 
 uniform vec2 tc_scale;
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl
index 99257daca4a..a172f49d879 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl
@@ -38,7 +38,7 @@ uniform int kern_length;
 uniform float kern_scale;
 uniform vec3 blur_quad;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 uniform mat4 inv_proj;
 uniform vec2 screen_res;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl
index 61c63936482..0d5c8e72874 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl
@@ -25,10 +25,10 @@
 
 uniform mat4 modelview_projection_matrix;
  
-attribute vec3 position;
+ATTRIBUTE vec3 position;
 
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 uniform vec2 screen_res;
 
 void main()
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl
index 615317febfd..c63a6279710 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl
@@ -28,11 +28,13 @@ uniform float maximum_alpha;
 
 uniform sampler2D diffuseMap;
 
-varying vec4 post_pos;
+VARYING vec4 post_pos;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main() 
 {
-	float alpha = texture2D(diffuseMap, gl_TexCoord[0].xy).a * gl_Color.a;
+	float alpha = texture2D(diffuseMap, vary_texcoord0.xy).a * vertex_color.a;
 
 	if (alpha < minimum_alpha || alpha > maximum_alpha)
 	{
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl
index f7bed00214d..6a3cba771bb 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl
@@ -26,11 +26,13 @@
 uniform mat4 texture_matrix0;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
 
-varying vec4 post_pos;
+VARYING vec4 post_pos;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
@@ -41,6 +43,6 @@ void main()
 	
 	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w);
 	
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
-	gl_FrontColor = diffuse_color;
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	vertex_color = diffuse_color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl
index 541f08d5fe7..ee0ea84e6f3 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl
@@ -25,7 +25,7 @@
  
 
 
-varying vec4 post_pos;
+VARYING vec4 post_pos;
 
 void main() 
 {
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl
index 190cac9e2ce..8b46e81f90c 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl
@@ -25,9 +25,9 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
+ATTRIBUTE vec3 position;
 
-varying vec4 post_pos;
+VARYING vec4 post_pos;
 
 void main()
 {
diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
index 59c0a994cdd..26c7165e067 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
@@ -29,7 +29,7 @@
 // The fragment shader for the sky
 /////////////////////////////////////////////////////////////////////////
 
-varying vec4 vary_HazeColor;
+VARYING vec4 vary_HazeColor;
 
 uniform sampler2D cloud_noise_texture;
 uniform vec4 gamma;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
index e97d3e08287..721de18e0b1 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl
@@ -25,15 +25,16 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
 
 // SKY ////////////////////////////////////////////////////////////////////////
 // The vertex shader for creating the atmospheric sky
 ///////////////////////////////////////////////////////////////////////////////
 
 // Output parameters
-varying vec4 vary_HazeColor;
+VARYING vec4 vary_HazeColor;
+VARYING vec2 vary_texcoord0;
 
 // Inputs
 uniform vec3 camPosLocal;
@@ -61,7 +62,7 @@ void main()
 
 	// World / view / projection
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
+	vary_texcoord0 = texcoord0;
 
 	// Get relative position
 	vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index 8116b7cdbfb..fa1d2cc7a7a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -64,7 +64,7 @@ uniform vec3 env_mat[3];
 uniform mat3 ssao_effect_mat;
 
 uniform vec3 sun_dir;
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 vec3 vary_PositionEye;
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl
index 7d1e99b4aaf..c6031fc45a2 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl
@@ -25,11 +25,11 @@
  
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
+ATTRIBUTE vec3 position;
 
 uniform vec2 screen_res;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 void main()
 {
 	//transform vertex
diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
index e69fa074c4d..20970fc4ba4 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
@@ -54,7 +54,7 @@ uniform vec3 color;
 uniform float falloff;
 uniform float size;
 
-varying vec4 vary_fragcoord;
+VARYING vec4 vary_fragcoord;
 uniform vec2 screen_res;
 
 uniform mat4 inv_proj;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl
index 4ab59d4d66a..8eb4be71777 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl
@@ -23,13 +23,14 @@
  * $/LicenseInfo$
  */
  
-
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 uniform sampler2D diffuseMap;
 
 void main() 
 {
-	vec4 col = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy);
+	vec4 col = vertex_color * texture2D(diffuseMap, vary_texcoord0.xy);
 	
 	gl_FragData[0] = col;
 	gl_FragData[1] = vec4(0,0,0,0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl
index 1fcb05ef2c8..8bc5b063799 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl
@@ -26,14 +26,17 @@
 uniform mat4 texture_matrix0;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	//transform vertex
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); 
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
-	gl_FrontColor = diffuse_color;
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	vertex_color = diffuse_color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
index 4a69192fc36..797648202d5 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
@@ -41,7 +41,7 @@ uniform float ssao_max_radius;
 uniform float ssao_factor;
 uniform float ssao_factor_inv;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 uniform mat4 inv_proj;
 uniform vec2 screen_res;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl
index 10751304ae2..473d6df8faa 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl
@@ -25,9 +25,9 @@
 
 uniform mat4 modelview_projection_matrix;
  
-attribute vec3 position;
+ATTRIBUTE vec3 position;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 uniform vec2 screen_res;
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl
index c6578ea177c..effa994a48c 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl
@@ -31,20 +31,22 @@ uniform sampler2D detail_2;
 uniform sampler2D detail_3;
 uniform sampler2D alpha_ramp;
 
-varying vec3 vary_normal;
+VARYING vec3 vary_normal;
+VARYING vec4 vary_texcoord0;
+VARYING vec4 vary_texcoord1;
 
 void main()
 {
 	/// Note: This should duplicate the blending functionality currently used for the terrain rendering.
 	
-	vec4 color0 = texture2D(detail_0, gl_TexCoord[0].xy);
-	vec4 color1 = texture2D(detail_1, gl_TexCoord[0].xy);
-	vec4 color2 = texture2D(detail_2, gl_TexCoord[0].xy);
-	vec4 color3 = texture2D(detail_3, gl_TexCoord[0].xy);
+	vec4 color0 = texture2D(detail_0, vary_texcoord0.xy);
+	vec4 color1 = texture2D(detail_1, vary_texcoord0.xy);
+	vec4 color2 = texture2D(detail_2, vary_texcoord0.xy);
+	vec4 color3 = texture2D(detail_3, vary_texcoord0.xy);
 
-	float alpha1 = texture2D(alpha_ramp, gl_TexCoord[0].zw).a;
-	float alpha2 = texture2D(alpha_ramp,gl_TexCoord[1].xy).a;
-	float alphaFinal = texture2D(alpha_ramp, gl_TexCoord[1].zw).a;
+	float alpha1 = texture2D(alpha_ramp, vary_texcoord0.zw).a;
+	float alpha2 = texture2D(alpha_ramp,vary_texcoord1.xy).a;
+	float alphaFinal = texture2D(alpha_ramp, vary_texcoord1.zw).a;
 	vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal );
 	
 	gl_FragData[0] = vec4(outColor.rgb, 0.0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
index 7f84ef1cff3..5effee4e4ea 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
@@ -27,13 +27,19 @@ uniform mat3 normal_matrix;
 uniform mat4 texture_matrix0;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
-attribute vec2 texcoord1;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec2 texcoord1;
 
-varying vec3 vary_normal;
+VARYING vec3 vary_normal;
+
+VARYING vec4 vary_texcoord0;
+VARYING vec4 vary_texcoord1;
+
+uniform vec4 object_plane_s;
+uniform vec4 object_plane_t;
 
 vec4 texgen_object(vec4  vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)
 {
@@ -57,11 +63,11 @@ void main()
 	vary_normal = normalize(normal_matrix * normal);
 	
 	// Transform and pass tex coords
- 	gl_TexCoord[0].xy = texgen_object(vec4(position, 1.0), vec4(texcoord0,0,1), texture_matrix0, gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy;
+ 	vary_texcoord0.xy = texgen_object(vec4(position, 1.0), vec4(texcoord0,0,1), texture_matrix0, object_plane_s, object_plane_t).xy;
 	
 	vec4 t = vec4(texcoord1,0,1);
 	
-	gl_TexCoord[0].zw = t.xy;
-	gl_TexCoord[1].xy = t.xy-vec2(2.0, 0.0);
-	gl_TexCoord[1].zw = t.xy-vec2(1.0, 0.0);
+	vary_texcoord0.zw = t.xy;
+	vary_texcoord1.xy = t.xy-vec2(2.0, 0.0);
+	vary_texcoord1.zw = t.xy-vec2(1.0, 0.0);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
index a6406bdc12e..b0ef348cd14 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl
@@ -27,20 +27,22 @@
 
 uniform sampler2D diffuseMap;
 
-varying vec3 vary_normal;
+VARYING vec4 vertex_color;
+VARYING vec3 vary_normal;
+VARYING vec2 vary_texcoord0;
 
 uniform float minimum_alpha;
 uniform float maximum_alpha;
 
 void main() 
 {
-	vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy);
+	vec4 col = texture2D(diffuseMap, vary_texcoord0.xy);
 	if (col.a < minimum_alpha || col.a > maximum_alpha)
 	{
 		discard;
 	}
 
-	gl_FragData[0] = vec4(gl_Color.rgb*col.rgb, 0.0);
+	gl_FragData[0] = vec4(vertex_color.rgb*col.rgb, 0.0);
 	gl_FragData[1] = vec4(0,0,0,0);
 	vec3 nvn = normalize(vary_normal);
 	gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl
index 9f0b902c96f..22ebaa9be6c 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl
@@ -1,7 +1,25 @@
 /** 
  * @file treeShadowF.glsl
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2005&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2005, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
  
@@ -10,11 +28,12 @@ uniform float maximum_alpha;
 
 uniform sampler2D diffuseMap;
 
-varying vec4 post_pos;
+VARYING vec4 post_pos;
+VARYING vec2 vary_texcoord0;
 
 void main() 
 {
-	float alpha = texture2D(diffuseMap, gl_TexCoord[0].xy).a;
+	float alpha = texture2D(diffuseMap, vary_texcoord0.xy).a;
 
 	if (alpha < minimum_alpha || alpha > maximum_alpha)
 	{
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl
index c695d374ac9..e472a753045 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl
@@ -26,10 +26,11 @@
 uniform mat4 texture_matrix0;
 uniform mat4 modelview_projection_matrix;
  
-attribute vec3 position;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
 
-varying vec4 post_pos;
+VARYING vec4 post_pos;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
@@ -40,5 +41,5 @@ void main()
 	
 	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w);
 	
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl
index 45bfc0ce09c..3b6571a24a9 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl
@@ -27,19 +27,21 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_projection_matrix;
 uniform mat3 normal_matrix;
 
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
 
-varying vec3 vary_normal;
+VARYING vec3 vary_normal;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	//transform vertex
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); 
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	vary_normal = normalize(normal_matrix * normal);
 
-	gl_FrontColor = vec4(1,1,1,1);
+	vertex_color = vec4(1,1,1,1);
 }
diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
index c3e7371c8e4..d10548cbefc 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
@@ -58,10 +58,10 @@ uniform vec2 screen_res;
 uniform mat4 norm_mat; //region space to screen space
 
 //bigWave is (refCoord.w, view.w);
-varying vec4 refCoord;
-varying vec4 littleWave;
-varying vec4 view;
-varying vec4 vary_position;
+VARYING vec4 refCoord;
+VARYING vec4 littleWave;
+VARYING vec4 view;
+VARYING vec4 vary_position;
 
 void main() 
 {
diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl
index ac51cb1741b..9734acf005a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl
@@ -26,7 +26,7 @@
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
+ATTRIBUTE vec3 position;
 
 
 void calcAtmospherics(vec3 inPositionEye);
@@ -37,11 +37,11 @@ uniform float time;
 uniform vec3 eyeVec;
 uniform float waterHeight;
 
-varying vec4 refCoord;
-varying vec4 littleWave;
-varying vec4 view;
+VARYING vec4 refCoord;
+VARYING vec4 littleWave;
+VARYING vec4 view;
 
-varying vec4 vary_position;
+VARYING vec4 vary_position;
 
 float wave(vec2 v, float t, float f, vec2 d, float s) 
 {
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
index c5ca9f48048..a34e76d25aa 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
@@ -34,9 +34,11 @@ uniform vec3 lumWeights;
 uniform vec3 warmthWeights;
 uniform float warmthAmount;
 
+VARYING vec2 vary_texcoord0;
+
 void main()
 {
-	vec4 col = texture2DRect(diffuseMap, gl_TexCoord[0].xy);	
+	vec4 col = texture2DRect(diffuseMap, vary_texcoord0.xy);	
 	/// CALCULATING LUMINANCE (Using NTSC lum weights)
 	/// http://en.wikipedia.org/wiki/Luma_%28video%29
 	float lum = smoothstep(minLuminance, minLuminance+1.0, dot(col.rgb, lumWeights ) );
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl
index c2cc8ed5677..cbf4dc4bea6 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl
@@ -35,9 +35,11 @@ uniform vec3 lumWeights;
 uniform vec3 warmthWeights;
 uniform float warmthAmount;
 
+VARYING vec2 vary_texcoord0;
+
 void main()
 {
-	ivec2 itc = ivec2(gl_TexCoord[0].xy);
+	ivec2 itc = ivec2(vary_texcoord0.xy);
 	vec4 fcol = vec4(0,0,0,0);
 
 	for (int i = 0; i < samples; i++)
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
index 628489296fa..1396dc69735 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
@@ -25,13 +25,14 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
 
+VARYING vec2 vary_texcoord0;
 
 void main() 
 {
 	gl_Position = modelview_projection_matrix * vec4(position, 1.0);
 	
-	gl_TexCoord[0].xy = texcoord0;
+	vary_texcoord0.xy = texcoord0;
 }
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowF.glsl
index 75cff75ea9e..3d17a20fbbe 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowF.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowF.glsl
@@ -28,6 +28,11 @@
 uniform sampler2D diffuseMap;
 uniform float glowStrength;
 
+VARYING vec4 vary_texcoord0;
+VARYING vec4 vary_texcoord1;
+VARYING vec4 vary_texcoord2;
+VARYING vec4 vary_texcoord3;
+
 void main()
 {
 
@@ -38,14 +43,14 @@ void main()
 		kern[0] = 0.25; kern[1] = 0.5; kern[2] = 0.8; kern[3] = 1.0;
 		kern[4] = 1.0;  kern[5] = 0.8; kern[6] = 0.5; kern[7] = 0.25;
 	
-	col += kern[0] * texture2D(diffuseMap, gl_TexCoord[0].xy);	
-	col += kern[1] * texture2D(diffuseMap, gl_TexCoord[1].xy);
-	col += kern[2] * texture2D(diffuseMap, gl_TexCoord[2].xy);	
-	col += kern[3] * texture2D(diffuseMap, gl_TexCoord[3].xy);	
-	col += kern[4] * texture2D(diffuseMap, gl_TexCoord[0].zw);	
-	col += kern[5] * texture2D(diffuseMap, gl_TexCoord[1].zw);	
-	col += kern[6] * texture2D(diffuseMap, gl_TexCoord[2].zw);	
-	col += kern[7] * texture2D(diffuseMap, gl_TexCoord[3].zw);	
+	col += kern[0] * texture2D(diffuseMap, vary_texcoord0.xy);	
+	col += kern[1] * texture2D(diffuseMap, vary_texcoord1.xy);
+	col += kern[2] * texture2D(diffuseMap, vary_texcoord2.xy);	
+	col += kern[3] * texture2D(diffuseMap, vary_texcoord3.xy);	
+	col += kern[4] * texture2D(diffuseMap, vary_texcoord0.zw);	
+	col += kern[5] * texture2D(diffuseMap, vary_texcoord1.zw);	
+	col += kern[6] * texture2D(diffuseMap, vary_texcoord2.zw);	
+	col += kern[7] * texture2D(diffuseMap, vary_texcoord3.zw);	
 	
 	gl_FragColor = vec4(col.rgb * glowStrength, col.a);
 }
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
index 615ca6a0b4d..cdb2281578e 100644
--- a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
+++ b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
@@ -25,21 +25,26 @@
  
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
 
 uniform vec2 glowDelta;
 
+VARYING vec4 vary_texcoord0;
+VARYING vec4 vary_texcoord1;
+VARYING vec4 vary_texcoord2;
+VARYING vec4 vary_texcoord3;
+
 void main() 
 {
 	gl_Position = modelview_projection_matrix * vec4(position, 1.0);
 	
-	gl_TexCoord[0].xy = texcoord0 + glowDelta*(-3.5);
-	gl_TexCoord[1].xy = texcoord0 + glowDelta*(-2.5);
-	gl_TexCoord[2].xy = texcoord0 + glowDelta*(-1.5);
-	gl_TexCoord[3].xy = texcoord0 + glowDelta*(-0.5);
-	gl_TexCoord[0].zw = texcoord0 + glowDelta*(0.5);
-	gl_TexCoord[1].zw = texcoord0 + glowDelta*(1.5);
-	gl_TexCoord[2].zw = texcoord0 + glowDelta*(2.5);
-	gl_TexCoord[3].zw = texcoord0 + glowDelta*(3.5);
+	vary_texcoord0.xy = texcoord0 + glowDelta*(-3.5);
+	vary_texcoord1.xy = texcoord0 + glowDelta*(-2.5);
+	vary_texcoord2.xy = texcoord0 + glowDelta*(-1.5);
+	vary_texcoord3.xy = texcoord0 + glowDelta*(-0.5);
+	vary_texcoord0.zw = texcoord0 + glowDelta*(0.5);
+	vary_texcoord1.zw = texcoord0 + glowDelta*(1.5);
+	vary_texcoord2.zw = texcoord0 + glowDelta*(2.5);
+	vary_texcoord3.zw = texcoord0 + glowDelta*(3.5);
 }
diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl
index c61d5a2a086..5d72390d2db 100644
--- a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl
@@ -29,13 +29,18 @@ uniform sampler2D detail0;
 uniform sampler2D detail1;
 uniform sampler2D alphaRamp;
 
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
+VARYING vec2 vary_texcoord2;
+VARYING vec2 vary_texcoord3;
+
 void main() 
 {
-	float a = texture2D(alphaRamp, gl_TexCoord[1].xy).a;
-	vec3 color = mix(texture2D(detail1, gl_TexCoord[2].xy).rgb,
-					 texture2D(detail0, gl_TexCoord[0].xy).rgb,
+	float a = texture2D(alphaRamp, vary_texcoord1.xy).a;
+	vec3 color = mix(texture2D(detail1, vary_texcoord2.xy).rgb,
+					 texture2D(detail0, vary_texcoord0.xy).rgb,
 					 a);
 
 	gl_FragColor.rgb = color;
-	gl_FragColor.a = texture2D(alphaRamp, gl_TexCoord[3].xy).a;
+	gl_FragColor.a = texture2D(alphaRamp, vary_texcoord3.xy).a;
 }
diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
index 04b3033dd83..d4a62db6841 100644
--- a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
@@ -31,14 +31,22 @@ uniform mat4 texture_matrix3;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
-attribute vec2 texcoord1;
-attribute vec2 texcoord2;
-attribute vec2 texcoord3;
+uniform vec4 object_plane_t;
+uniform vec4 object_plane_s;
 
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec2 texcoord1;
+ATTRIBUTE vec2 texcoord2;
+ATTRIBUTE vec2 texcoord3;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
+VARYING vec2 vary_texcoord2;
+VARYING vec2 vary_texcoord3;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 
@@ -61,15 +69,15 @@ void main()
 	//transform vertex
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
 			
-	vec4 pos = modelview_matrix * position;
+	vec4 pos = modelview_matrix * vec4(position, 1.0);
 	vec3 norm = normalize(normal_matrix * normal);
 	
 	vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), diffuse_color);
 	
-	gl_FrontColor = color;
+	vertex_color = color;
 	
-	gl_TexCoord[0] = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord0,0,1),texture_matrix0,gl_ObjectPlaneS[0],gl_ObjectPlaneT[0]);
-	gl_TexCoord[1] = texture_matrix1*vec4(texcoord1,0,1);
-	gl_TexCoord[2] = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord2,0,1),texture_matrix2,gl_ObjectPlaneS[2],gl_ObjectPlaneT[2]);
-	gl_TexCoord[3] = texture_matrix3*vec4(texcoord3,0,1);
+	vary_texcoord0 = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord0,0,1),texture_matrix0,object_plane_s,object_plane_t).xy;
+	vary_texcoord1 = (texture_matrix1*vec4(texcoord1,0,1)).xy;
+	vary_texcoord2 = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord2,0,1),texture_matrix2,object_plane_s,object_plane_t).xy;
+	vary_texcoord3 = (texture_matrix3*vec4(texcoord3,0,1)).xy;
 }
diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl
index 711b42b95ed..307b87e086f 100644
--- a/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl
@@ -31,13 +31,18 @@ uniform sampler2D detail0;
 uniform sampler2D detail1;
 uniform sampler2D alphaRamp;
 
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
+VARYING vec2 vary_texcoord2;
+VARYING vec2 vary_texcoord3;
+
 void main() 
 {
-	float a = texture2D(alphaRamp, gl_TexCoord[1].xy).a;
-	vec3 color = mix(texture2D(detail1, gl_TexCoord[2].xy).rgb,
-					 texture2D(detail0, gl_TexCoord[0].xy).rgb,
+	float a = texture2D(alphaRamp, vary_texcoord1.xy).a;
+	vec3 color = mix(texture2D(detail1, vary_texcoord2.xy).rgb,
+					 texture2D(detail0, vary_texcoord0.xy).rgb,
 					 a);
 
 	gl_FragColor.rgb = color;
-	gl_FragColor.a = texture2D(alphaRamp, gl_TexCoord[3].xy).a;
+	gl_FragColor.a = texture2D(alphaRamp, vary_texcoord3.xy).a;
 }
diff --git a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl
index 72e8e739b39..48eea0bdda2 100644
--- a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl
@@ -33,9 +33,9 @@ uniform float refScale;
 uniform vec4 waterFogColor;
 
 //bigWave is (refCoord.w, view.w);
-varying vec4 refCoord;
-varying vec4 littleWave;
-varying vec4 view;
+VARYING vec4 refCoord;
+VARYING vec4 littleWave;
+VARYING vec4 view;
 
 void main() 
 {
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
index 4d555b566ab..1bb04ceb348 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
@@ -50,9 +50,9 @@ uniform float blurMultiplier;
 uniform vec4 fogCol;
 
 //bigWave is (refCoord.w, view.w);
-varying vec4 refCoord;
-varying vec4 littleWave;
-varying vec4 view;
+VARYING vec4 refCoord;
+VARYING vec4 littleWave;
+VARYING vec4 view;
 
 void main() 
 {
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
index d44690d1fb4..e4db326bede 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
@@ -24,15 +24,16 @@
  */
  
 
+VARYING float fog_depth;
 
 vec4 applyWaterFog(vec4 color)
 {
 	// GL_EXP2 Fog
-	//float fog = exp(-gl_Fog.density * gl_Fog.density * gl_FogFragCoord * gl_FogFragCoord);
+	//float fog = exp(-gl_Fog.density * gl_Fog.density * fog_depth * fog_depth);
 	// GL_EXP Fog
-	// float fog = exp(-gl_Fog.density * gl_FogFragCoord);
+	// float fog = exp(-gl_Fog.density * fog_depth);
 	// GL_LINEAR Fog
-	float fog = (gl_Fog.end - gl_FogFragCoord) * gl_Fog.scale;
+	float fog = (gl_Fog.end - fog_depth) * gl_Fog.scale;
 	fog = clamp(fog, 0.0, 1.0);
 	color.rgb = mix(gl_Fog.color.rgb, color.rgb, fog);
 	return color;
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
index 99433ada7bd..f66ba1d2d94 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl
@@ -26,7 +26,7 @@
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
+ATTRIBUTE vec3 position;
 
 void calcAtmospherics(vec3 inPositionEye);
 
@@ -36,9 +36,9 @@ uniform float time;
 uniform vec3 eyeVec;
 uniform float waterHeight;
 
-varying vec4 refCoord;
-varying vec4 littleWave;
-varying vec4 view;
+VARYING vec4 refCoord;
+VARYING vec4 littleWave;
+VARYING vec4 view;
 
 float wave(vec2 v, float t, float f, vec2 d, float s) 
 {
diff --git a/indra/newview/app_settings/shaders/class1/interface/customalphaF.glsl b/indra/newview/app_settings/shaders/class1/interface/customalphaF.glsl
index 27c63fdc8b9..66f3e1ae11b 100644
--- a/indra/newview/app_settings/shaders/class1/interface/customalphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/customalphaF.glsl
@@ -27,9 +27,12 @@ uniform sampler2D diffuseMap;
 
 uniform float custom_alpha;
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void main() 
 {
-	vec4 color = gl_Color*texture2D(diffuseMap, gl_TexCoord[0].xy);
+	vec4 color = vertex_color*texture2D(diffuseMap, vary_texcoord0.xy);
 	color.a *= custom_alpha;
 	gl_FragColor = color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl b/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl
index 5bbc7deff03..890474d6d8c 100644
--- a/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl
@@ -25,15 +25,17 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
-	gl_FrontColor = diffuse_color;
+	vary_texcoord0 = texcoord0;
+	vertex_color = diffuse_color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/interface/debugV.glsl b/indra/newview/app_settings/shaders/class1/interface/debugV.glsl
index cd3d090e52a..f4d704577ad 100644
--- a/indra/newview/app_settings/shaders/class1/interface/debugV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/debugV.glsl
@@ -25,7 +25,7 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
+ATTRIBUTE vec3 position;
 
 void main()
 {
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
index b8963e1decb..caff5fc324a 100644
--- a/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl
@@ -28,8 +28,11 @@
 uniform sampler2D glowMap;
 uniform sampler2DRect screenMap;
 
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
+
 void main() 
 {
-	gl_FragColor = texture2D(glowMap, gl_TexCoord[0].xy) +
-					texture2DRect(screenMap, gl_TexCoord[1].xy);
+	gl_FragColor = texture2D(glowMap, vary_texcoord0.xy) +
+					texture2DRect(screenMap, vary_texcoord1.xy);
 }
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl
index 6639f88047d..3e972f0cb49 100644
--- a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl
@@ -1,7 +1,25 @@
 /** 
  * @file glowcombineFXAAF.glsl
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2005&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2005, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
  
@@ -11,7 +29,7 @@ uniform sampler2D glowMap;
 uniform sampler2DRect screenMap;
 
 uniform vec2 screen_res;
-varying vec2 vary_tc;
+VARYING vec2 vary_tc;
 
 void main() 
 {
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl
index bd5dd6046b0..058f3b1b820 100644
--- a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl
@@ -25,9 +25,9 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
+ATTRIBUTE vec3 position;
 
-varying vec2 vary_tc;
+VARYING vec2 vary_tc;
 
 void main()
 {
diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl
index 94edbe5ab14..f7970b7f78b 100644
--- a/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl
@@ -25,14 +25,17 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec2 texcoord0;
-attribute vec2 texcoord1;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec2 texcoord1;
+
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
 
 void main()
 {
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
-	gl_TexCoord[1] = vec4(texcoord1,0,1);
+	vary_texcoord0 = texcoord0;
+	vary_texcoord1 = texcoord1;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl
index 3a48205101c..1d37b97bf16 100644
--- a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl
@@ -27,7 +27,9 @@
 uniform vec4 color;
 uniform sampler2D diffuseMap;
 
+VARYING vec2 vary_texcoord0;
+
 void main() 
 {
-	gl_FragColor = color*texture2D(diffuseMap, gl_TexCoord[0].xy);
+	gl_FragColor = color*texture2D(diffuseMap, vary_texcoord0.xy);
 }
diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
index 6bb5affd931..9bf7b60eb76 100644
--- a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl
@@ -26,13 +26,15 @@
 uniform mat4 texture_matrix0;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	//transform vertex
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl b/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl
index 43dcd5dbe26..c26fa08ddc6 100644
--- a/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl
@@ -25,7 +25,7 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
+ATTRIBUTE vec3 position;
 
 void main()
 {
diff --git a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl
index a5442c9bf42..d8601063053 100644
--- a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl
@@ -1,13 +1,33 @@
 /** 
  * @file onetexturenocolorF.glsl
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2005&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2005, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
  
 uniform sampler2D tex0;
 
+VARYING vec2 vary_texcoord0;
+
 void main() 
 {
-	gl_FragColor = texture2D(tex0, gl_TexCoord[0].xy);
+	gl_FragColor = texture2D(tex0, vary_texcoord0.xy);
 }
diff --git a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl
index 615412c7a2e..6b9986c8d7f 100644
--- a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl
@@ -25,13 +25,14 @@
  
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
 
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	gl_Position = modelview_projection_matrix * vec4(position, 1);
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
+	vary_texcoord0 = texcoord0;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl b/indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl
index b1d2b949acc..a25c9a08fbe 100644
--- a/indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl
@@ -25,9 +25,12 @@
  
 uniform sampler2D tex0;
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void main() 
 {
-	float alpha = texture2D(tex0, gl_TexCoord[0].xy).a * gl_Color.a;
+	float alpha = texture2D(tex0, vary_texcoord0.xy).a * vertex_color.a;
 
-	gl_FragColor = vec4(gl_Color.rgb, alpha);
+	gl_FragColor = vec4(vertex_color.rgb, alpha);
 }
diff --git a/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl b/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl
index 45e6a9febce..c58f9dfdaf8 100644
--- a/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl
@@ -25,14 +25,17 @@
 
 uniform mat4 modelview_projection_matrix;
  
-attribute vec3 position;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
-	gl_FrontColor = diffuse_color;
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
+	vertex_color = diffuse_color;
+	vary_texcoord0 = texcoord0;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl b/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl
index c263f4dc6a9..9a295ce9f2a 100644
--- a/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl
@@ -27,7 +27,10 @@
 
 uniform sampler2DRect screenMap;
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void main() 
 {
-	gl_FragColor = 	texture2DRect(screenMap, gl_TexCoord[0].xy) * gl_Color;
+	gl_FragColor = 	texture2DRect(screenMap, vary_texcoord0.xy) * vertex_color;
 }
diff --git a/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl b/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl
index 2b471d99e82..641d670c267 100644
--- a/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl
@@ -25,14 +25,17 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec2 texcoord0;
-attribute vec4 diffuse_color;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec4 diffuse_color;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
-	gl_FrontColor = diffuse_color;
+	vary_texcoord0 = texcoord0;
+	vertex_color = diffuse_color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/interface/twotextureaddF.glsl b/indra/newview/app_settings/shaders/class1/interface/twotextureaddF.glsl
index 3408cc44f8e..3ded949943e 100644
--- a/indra/newview/app_settings/shaders/class1/interface/twotextureaddF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/twotextureaddF.glsl
@@ -26,7 +26,10 @@
 uniform sampler2D tex0;
 uniform sampler2D tex1;
 
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
+
 void main() 
 {
-	gl_FragColor = texture2D(tex0, gl_TexCoord[0].xy)+texture2D(tex1, gl_TexCoord[1].xy);
+	gl_FragColor = texture2D(tex0, vary_texcoord0.xy)+texture2D(tex1, vary_texcoord1.xy);
 }
diff --git a/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl b/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl
index 2a36feaa211..3c2f297f7f5 100644
--- a/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl
@@ -25,14 +25,17 @@
  
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec2 texcoord0;
-attribute vec2 texcoord1;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec2 texcoord1;
+
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
 
 void main()
 {
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
-	gl_TexCoord[1] = vec4(texcoord1,0,1);
+	vary_texcoord0 = texcoord0;
+	vary_texcoord1 = texcoord1;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/interface/uiF.glsl b/indra/newview/app_settings/shaders/class1/interface/uiF.glsl
index 7694056b08f..2602e489c8b 100644
--- a/indra/newview/app_settings/shaders/class1/interface/uiF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/uiF.glsl
@@ -25,7 +25,10 @@
  
 uniform sampler2D diffuseMap;
 
+VARYING vec2 vary_texcoord0;
+VARYING vec4 vertex_color;
+
 void main() 
 {
-	gl_FragColor = gl_Color*texture2D(diffuseMap, gl_TexCoord[0].xy);
+	gl_FragColor = vertex_color*texture2D(diffuseMap, vary_texcoord0.xy);
 }
diff --git a/indra/newview/app_settings/shaders/class1/interface/uiV.glsl b/indra/newview/app_settings/shaders/class1/interface/uiV.glsl
index a9e42a432f0..220dafef25d 100644
--- a/indra/newview/app_settings/shaders/class1/interface/uiV.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/uiV.glsl
@@ -26,15 +26,17 @@
 uniform mat4 texture_matrix0;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	gl_Position = modelview_projection_matrix * vec4(position, 1);
-	gl_TexCoord[0] =  texture_matrix0 * vec4(texcoord0,0,1);
-	gl_FrontColor = diffuse_color;
+	vary_texcoord0 =  (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	vertex_color = diffuse_color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl
index 5cb3eb05a7c..0a687d7a33c 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl
@@ -23,13 +23,14 @@
  * $/LicenseInfo$
  */
  
-
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 uniform sampler2D diffuseMap;
 
 void default_lighting() 
 {
-	vec4 color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy);
+	vec4 color = vertex_color * texture2D(diffuseMap, vary_texcoord0.xy);
 	gl_FragColor = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl
index f3ba8b73a80..7ba6e9dec90 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl
@@ -28,8 +28,10 @@
 
 uniform sampler2D diffuseMap;
 
+VARYING vec2 vary_texcoord0;
+
 void fullbright_lighting()
 {
-	gl_FragColor = texture2D(diffuseMap, gl_TexCoord[0].xy);
+	gl_FragColor = texture2D(diffuseMap, vary_texcoord0.xy);
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl
index b4c8a9abced..00c08d59ef4 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl
@@ -29,7 +29,9 @@
 uniform sampler2D diffuseMap;
 uniform samplerCube environmentMap;
 
+VARYING vec2 vary_texcoord0;
+
 void fullbright_shiny_lighting() 
 {
-	gl_FragColor = texture2D(diffuseMap, gl_TexCoord[0].xy);
+	gl_FragColor = texture2D(diffuseMap, vary_texcoord0.xy);
 }
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl
index 925d6fbcfd8..2140b2f6128 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl
@@ -28,7 +28,9 @@
 uniform sampler2D diffuseMap;
 uniform samplerCube environmentMap;
 
+VARYING vec2 vary_texcoord0;
+
 void fullbright_shiny_lighting_water() 
 {
-	gl_FragColor = texture2D(diffuseMap, gl_TexCoord[0].xy);
+	gl_FragColor = texture2D(diffuseMap, vary_texcoord0.xy);
 }
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl
index 71238f7d316..ab6b561f08d 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl
@@ -28,8 +28,10 @@
 
 uniform sampler2D diffuseMap;
 
+VARYING vec2 vary_texcoord0;
+
 void fullbright_lighting_water()
 {
-	gl_FragColor = texture2D(diffuseMap, gl_TexCoord[0].xy);
+	gl_FragColor = texture2D(diffuseMap, vary_texcoord0.xy);
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl
index 7c9b7c218f9..183582e41f9 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl
@@ -24,14 +24,15 @@
  */
  
 
-
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 uniform sampler2D diffuseMap;
 uniform samplerCube environmentMap;
 
 void shiny_lighting() 
 {
-	vec4 color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy);
+	vec4 color = vertex_color * texture2D(diffuseMap, vary_texcoord0.xy);
 	gl_FragColor = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl
index ca1af8fc795..9c9f7ca658a 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl
@@ -24,14 +24,15 @@
  */
  
 
-
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 uniform sampler2D diffuseMap;
 uniform samplerCube environmentMap;
 
 void shiny_lighting_water() 
 {
-	vec4 color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy);
+	vec4 color = vertex_color * texture2D(diffuseMap, vary_texcoord0.xy);
 	gl_FragColor = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl
index da76a977b64..1a041c26ca6 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl
@@ -23,13 +23,14 @@
  * $/LicenseInfo$
  */
  
-
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 uniform sampler2D diffuseMap;
 
 void default_lighting_water() 
 {
-	vec4 color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy);
+	vec4 color = vertex_color * texture2D(diffuseMap, vary_texcoord0.xy);
 	gl_FragColor = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/objects/bumpF.glsl b/indra/newview/app_settings/shaders/class1/objects/bumpF.glsl
index 11031a88298..53c0e77b48c 100644
--- a/indra/newview/app_settings/shaders/class1/objects/bumpF.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/bumpF.glsl
@@ -26,10 +26,13 @@
 uniform sampler2D texture0;
 uniform sampler2D texture1;
 
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
+
 void main() 
 {
-	float tex0 = texture2D(texture0, gl_TexCoord[0].xy).a;
-	float tex1 = texture2D(texture1, gl_TexCoord[1].xy).a;
+	float tex0 = texture2D(texture0, vary_texcoord0.xy).a;
+	float tex1 = texture2D(texture1, vary_texcoord1.xy).a;
 
 	gl_FragColor = vec4(tex0+(1.0-tex1)-0.5);
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl
index dccc6925930..09ec6ff7925 100644
--- a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl
@@ -27,14 +27,17 @@ uniform mat4 texture_matrix0;
 uniform mat4 texture_matrix1;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec2 texcoord0;
-attribute vec2 texcoord1;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec2 texcoord1;
+
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
 
 void main()
 {
 	//transform vertex
 	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
-	gl_TexCoord[1] = texture_matrix1 * vec4(texcoord1,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	vary_texcoord1 = (texture_matrix1 * vec4(texcoord1,0,1)).xy;
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl
index e2a00e84407..bf4c45f18f8 100644
--- a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl
@@ -27,9 +27,13 @@ uniform mat4 projection_matrix;
 uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 
-attribute vec3 position;
-attribute float emissive;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE float emissive;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
 
 void calcAtmospherics(vec3 inPositionEye);
 mat4 getObjectSkinnedTransform();
@@ -37,7 +41,7 @@ mat4 getObjectSkinnedTransform();
 void main()
 {
 	//transform vertex
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	mat4 mat = getObjectSkinnedTransform();
 	
@@ -46,9 +50,9 @@ void main()
 	
 	calcAtmospherics(pos.xyz);
 
-	gl_FrontColor = vec4(0,0,0,emissive);
+	vertex_color = vec4(0,0,0,emissive);
 	
 	gl_Position = projection_matrix*vec4(pos, 1.0);
 		
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl
index dedf00f3743..0e05beac678 100644
--- a/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl
@@ -27,25 +27,29 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec4 position;
-attribute float emissive;
-attribute vec2 texcoord0;
+ATTRIBUTE vec4 position;
+ATTRIBUTE float emissive;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 void calcAtmospherics(vec3 inPositionEye);
 
-varying float vary_texture_index;
+VARYING float vary_texture_index;
+VARYING float fog_depth;
 
 void main()
 {
 	//transform vertex
 	vary_texture_index = position.w;
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
 	calcAtmospherics(pos.xyz);
 
-	gl_FrontColor = vec4(0,0,0,emissive);
+	vertex_color = vec4(0,0,0,emissive);
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl
index b9c1078c309..f73760bfd4e 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl
@@ -27,9 +27,13 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec2 texcoord0;
-attribute vec3 normal;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec3 normal;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
 
 void calcAtmospherics(vec3 inPositionEye);
 
@@ -39,11 +43,11 @@ void main()
 	vec4 vert = vec4(position.xyz,1.0);
 	vec4 pos = (modelview_matrix * vert);
 	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 
 	calcAtmospherics(pos.xyz);
 
-	gl_FrontColor = vec4(1,1,1,1);
+	vertex_color = vec4(1,1,1,1);
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl
index 546b7cad4af..69cd858b4d3 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl
@@ -27,10 +27,15 @@ uniform mat4 texture_matrix1;
 uniform mat4 modelview_matrix;
 uniform mat4 projection_matrix;
 
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
+VARYING float fog_depth;
 
 void calcAtmospherics(vec3 inPositionEye);
 mat4 getObjectSkinnedTransform();
@@ -49,14 +54,14 @@ void main()
 		
 	vec3 ref = reflect(pos.xyz, -norm.xyz);
 
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
-	gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	vary_texcoord1 = (texture_matrix1*vec4(ref,1.0)).xyz;
 
 	calcAtmospherics(pos.xyz);
 
-	gl_FrontColor = diffuse_color;
+	vertex_color = diffuse_color;
 	
 	gl_Position = projection_matrix*vec4(pos, 1.0);
 	
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl
index a9b086e215e..a8e640018da 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl
@@ -29,10 +29,15 @@ uniform mat4 texture_matrix1;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec4 diffuse_color;
-attribute vec3 normal;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
+VARYING float fog_depth;
 
 void calcAtmospherics(vec3 inPositionEye);
 
@@ -46,13 +51,13 @@ void main()
 	vec3 norm = normalize(normal_matrix * normal);
 	vec3 ref = reflect(pos.xyz, -norm);
 
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
-	gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	vary_texcoord1 = (texture_matrix1*vec4(ref,1.0)).xyz;
 
 	vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
 	calcAtmospherics(pos.xyz);
 
-	gl_FrontColor = diffuse_color;
+	vertex_color = diffuse_color;
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl
index f0722a1e4d8..4de24fd46b0 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl
@@ -26,17 +26,21 @@ uniform mat4 projection_matrix;
 uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 
-attribute vec3 position;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
 
 void calcAtmospherics(vec3 inPositionEye);
 mat4 getObjectSkinnedTransform();
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
+
 void main()
 {
 	//transform vertex
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	mat4 mat = getObjectSkinnedTransform();
 	
@@ -45,9 +49,9 @@ void main()
 	
 	calcAtmospherics(pos.xyz);
 
-	gl_FrontColor = diffuse_color;
+	vertex_color = diffuse_color;
 	
 	gl_Position = projection_matrix*vec4(pos, 1.0);
 		
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl
index d8f223d403f..7286e5e2f45 100644
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl
@@ -27,9 +27,13 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
 
 void calcAtmospherics(vec3 inPositionEye);
 
@@ -38,13 +42,13 @@ void main()
 	//transform vertex
 	vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 
 
 	calcAtmospherics(pos.xyz);
 
-	gl_FrontColor = diffuse_color;
+	vertex_color = diffuse_color;
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl
index d09db8e6a34..e5bf5bf2d30 100644
--- a/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl
@@ -28,9 +28,11 @@ uniform float maximum_alpha;
 
 uniform sampler2D diffuseMap;
 
+VARYING vec2 vary_texcoord0;
+
 void main()
 {
-	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy);
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy);
 	
 	if (color.a < minimum_alpha || color.a > maximum_alpha)
 	{
diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl
index 69007610c6e..e90dbb115a4 100644
--- a/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl
@@ -27,12 +27,14 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_projection_matrix;
 
 
-attribute vec3 position;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec2 vary_texcoord0;
 
 void main()
 {
 	//transform vertex
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy;
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
index 3771c2e795d..282686a9b07 100644
--- a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
@@ -28,9 +28,13 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
@@ -40,14 +44,14 @@ void main()
 	//transform vertex
 	vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 		
 	vec3 norm = normalize(normal_matrix * normal);
 
 	calcAtmospherics(pos.xyz);
 
 	vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.));
-	gl_FrontColor = color;
+	vertex_color = color;
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl
index 7e5c8ca2d59..591d6fc5c94 100644
--- a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl
@@ -27,10 +27,14 @@ uniform mat4 texture_matrix0;
 uniform mat4 texture_matrix1;
 uniform mat4 modelview_matrix;
 
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
@@ -50,13 +54,13 @@ void main()
 		
 	vec3 ref = reflect(pos.xyz, -norm.xyz);
 
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
-	gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	vary_texcoord1 = (texture_matrix1*vec4(ref,1.0)).xyz;
 
 	calcAtmospherics(pos.xyz);
 
 	vec4 color = calcLighting(pos.xyz, norm.xyz, diffuse_color, vec4(0.));
-	gl_FrontColor = color;
+	vertex_color = color;
 	
 	gl_Position = projection_matrix*vec4(pos, 1.0);
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl
index da47f8a58aa..86a78b190c1 100644
--- a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl
@@ -28,10 +28,14 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec3 vary_texcoord0;
+VARYING float fog_depth;
 
 void calcAtmospherics(vec3 inPositionEye);
 
@@ -47,12 +51,12 @@ void main()
 
 	calcAtmospherics(pos.xyz);
 	
-	gl_FrontColor = diffuse_color;
+	vertex_color = diffuse_color;
 	
 	vec3 ref = reflect(pos.xyz, -norm);
 	
-	gl_TexCoord[0] = texture_matrix0*vec4(ref,1.0);
+	vary_texcoord0 = (texture_matrix0*vec4(ref,1.0)).xyz;
 	
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl
index d1d8126cb46..45a493e4f2d 100644
--- a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl
@@ -28,9 +28,13 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
@@ -40,14 +44,14 @@ void main()
 	//transform vertex
 	vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 		
 	vec3 norm = normalize(normal_matrix * normal);
 
 	calcAtmospherics(pos.xyz);
 
 	vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.));
-	gl_FrontColor = color;
+	vertex_color = color;
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl
index bf083a55c47..aea0e25e60e 100644
--- a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl
@@ -26,10 +26,14 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 uniform mat4 projection_matrix;
 
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
@@ -38,7 +42,7 @@ mat4 getObjectSkinnedTransform();
 void main()
 {
 	//transform vertex
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	mat4 mat = getObjectSkinnedTransform();
 	
@@ -53,9 +57,9 @@ void main()
 	calcAtmospherics(pos.xyz);
 
 	vec4 color = calcLighting(pos.xyz, norm.xyz, diffuse_color, vec4(0.));
-	gl_FrontColor = color;
+	vertex_color = color;
 	
 	gl_Position = projection_matrix*vec4(pos, 1.0);
 	
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl
index 87ece3972ee..4b6b2197516 100644
--- a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl
@@ -28,10 +28,14 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
@@ -41,14 +45,14 @@ void main()
 	//transform vertex
 	vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 		
 	vec3 norm = normalize(normal_matrix * normal);
 
 	calcAtmospherics(pos.xyz);
 
 	vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
-	gl_FrontColor = color;
+	vertex_color = color;
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class1/objects/treeV.glsl b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl
index 64ca63731b1..250d99a9c76 100644
--- a/indra/newview/app_settings/shaders/class1/objects/treeV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl
@@ -28,20 +28,24 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec2 texcoord0;
-attribute vec3 normal;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec3 normal;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
+
 void main()
 {
 	//transform vertex
 	vec4 vert = vec4(position.xyz,1.0);
 	
 	gl_Position = modelview_projection_matrix*vert;
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy;
 	
 	vec4 pos = (modelview_matrix * vert);
 	
@@ -50,7 +54,7 @@ void main()
 	calcAtmospherics(pos.xyz);
 
 	vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.));
-	gl_FrontColor = color;
+	vertex_color = color;
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl
index dbacf286371..2e413601508 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl
@@ -25,7 +25,7 @@
  
 
 
-varying vec3 vary_PositionEye;
+VARYING vec3 vary_PositionEye;
 
 vec3 getPositionEye()
 {
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl
index e051ac9851e..42f8646f2d0 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl
@@ -25,7 +25,7 @@
  
 
 
-varying vec3 vary_PositionEye;
+VARYING vec3 vary_PositionEye;
 
 
 vec3 getPositionEye()
diff --git a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl
index 43e19909d4e..04d3e2aa1f9 100644
--- a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl
+++ b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl
@@ -28,10 +28,14 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec4 diffuse_color;
-attribute vec3 normal;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
 
 vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
@@ -41,7 +45,7 @@ void main()
 	//transform vertex
 	vec3 pos = (modelview_matrix * vec4(position.xyz, 1.0)).xyz;
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 		
 	vec3 norm = normalize(normal_matrix * normal);
 
@@ -51,8 +55,8 @@ void main()
 	vec4 specular = vec4(1.0);
 	vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0));
 			
-	gl_FrontColor = color;
-	gl_FogFragCoord = pos.z;
+	vertex_color = color;
+	fog_depth = pos.z;
 
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index 839606cdcb8..4fffb9e97fe 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -27,6 +27,9 @@
 
 #extension GL_ARB_texture_rectangle : enable
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 uniform sampler2DRectShadow shadowMap0;
 uniform sampler2DRectShadow shadowMap1;
 uniform sampler2DRectShadow shadowMap2;
@@ -41,11 +44,11 @@ uniform vec2 shadow_res;
 vec3 atmosLighting(vec3 light);
 vec3 scaleSoftClip(vec3 light);
 
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_fragcoord;
-varying vec3 vary_position;
-varying vec3 vary_pointlight_col;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_position;
+VARYING vec3 vary_pointlight_col;
 
 uniform float shadow_bias;
 
@@ -122,9 +125,9 @@ void main()
 		}
 	}
 	
-	vec4 diff = diffuseLookup(gl_TexCoord[0].xy);
+	vec4 diff = diffuseLookup(vary_texcoord0.xy);
 
-	vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, gl_Color.a);
+	vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, vertex_color.a);
 	vec4 color = diff * col;
 	
 	color.rgb = atmosLighting(color.rgb);
@@ -133,7 +136,7 @@ void main()
 
 	color.rgb += diff.rgb * vary_pointlight_col.rgb;
 
-	//gl_FragColor = gl_Color;
+	//gl_FragColor = vertex_color;
 	gl_FragColor = color;
 	//gl_FragColor.r = 0.0;
 	//gl_FragColor = vec4(1,shadow,1,1);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl
index 84e49a5f8f1..30aa82473ad 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl
@@ -42,11 +42,13 @@ uniform vec2 shadow_res;
 vec3 atmosLighting(vec3 light);
 vec3 scaleSoftClip(vec3 light);
 
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_fragcoord;
-varying vec3 vary_position;
-varying vec3 vary_pointlight_col;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_position;
+VARYING vec3 vary_pointlight_col;
+VARYING vec2 vary_texcoord0;
+VARYING vec4 vertex_color;
 
 uniform float shadow_bias;
 
@@ -123,9 +125,9 @@ void main()
 		}
 	}
 	
-	vec4 diff = texture2D(diffuseMap,gl_TexCoord[0].xy);
+	vec4 diff = texture2D(diffuseMap,vary_texcoord0.xy);
 
-	vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, gl_Color.a);
+	vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, vertex_color.a);
 	vec4 color = diff * col;
 	
 	color.rgb = atmosLighting(color.rgb);
@@ -134,7 +136,7 @@ void main()
 
 	color.rgb += diff.rgb * vary_pointlight_col.rgb;
 
-	//gl_FragColor = gl_Color;
+	//gl_FragColor = vertex_color;
 	gl_FragColor = color;
 	//gl_FragColor.r = 0.0;
 	//gl_FragColor = vec4(1,shadow,1,1);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl
index 294a000ab5d..9370b484b84 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl
@@ -1,7 +1,25 @@
 /** 
  * @file alphaNonIndexedNoColorF.glsl
  *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2005&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2005, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
  * $/LicenseInfo$
  */
  
@@ -24,11 +42,12 @@ uniform vec2 shadow_res;
 vec3 atmosLighting(vec3 light);
 vec3 scaleSoftClip(vec3 light);
 
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_fragcoord;
-varying vec3 vary_position;
-varying vec3 vary_pointlight_col;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_position;
+VARYING vec3 vary_pointlight_col;
+VARYING vec2 vary_texcoord0;
 
 uniform float shadow_bias;
 
@@ -105,7 +124,7 @@ void main()
 		}
 	}
 	
-	vec4 diff = texture2D(diffuseMap,gl_TexCoord[0].xy);
+	vec4 diff = texture2D(diffuseMap,vary_texcoord0.xy);
 
 	vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, 1.0);
 	vec4 color = diff * col;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
index c3148d5fdf0..ad353eb6247 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
@@ -27,10 +27,10 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
  
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
@@ -42,11 +42,15 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
 vec3 scaleDownLight(vec3 light);
 vec3 scaleUpLight(vec3 light);
 
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_fragcoord;
-varying vec3 vary_position;
-varying vec3 vary_pointlight_col;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_position;
+VARYING vec3 vary_pointlight_col;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
 
 uniform float near_clip;
 uniform float shadow_offset;
@@ -89,7 +93,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
 
 void main()
 {
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	mat4 mat = getObjectSkinnedTransform();
 	
@@ -134,9 +138,9 @@ void main()
 	
 	col.rgb = min(col.rgb*diffuse_color.rgb, 1.0);
 	
-	gl_FrontColor = col;
+	vertex_color = col;
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 	
 	pos.xyz = (modelview_projection_matrix * vec4(position.xyz, 1.0)).xyz;
 	vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
index 8d55616e67c..268e4127a28 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
@@ -28,10 +28,10 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec4 position;
-attribute vec3 normal;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec4 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
@@ -43,12 +43,15 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
 vec3 scaleDownLight(vec3 light);
 vec3 scaleUpLight(vec3 light);
 
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_fragcoord;
-varying vec3 vary_position;
-varying vec3 vary_pointlight_col;
-varying float vary_texture_index;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_position;
+VARYING vec3 vary_pointlight_col;
+VARYING float vary_texture_index;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
 
 uniform float near_clip;
 uniform float shadow_offset;
@@ -97,7 +100,7 @@ void main()
 	vec4 pos = (modelview_matrix * vert);
 	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
 	
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 		
 	vec3 norm = normalize(normal_matrix * normal);
 	
@@ -130,9 +133,9 @@ void main()
 	
 	col.rgb = col.rgb*diffuse_color.rgb;
 	
-	gl_FrontColor = col;
+	vertex_color = col;
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 	
 	pos = modelview_projection_matrix * vert;
 	vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
index 0273f3c1210..091a8651609 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl
@@ -25,9 +25,9 @@
  
 uniform mat4 projection_matrix;
 
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 mat4 getSkinnedTransform();
@@ -41,11 +41,14 @@ vec3 atmosAffectDirectionalLight(float lightIntensity);
 vec3 scaleDownLight(vec3 light);
 vec3 scaleUpLight(vec3 light);
 
-varying vec3 vary_position;
-varying vec3 vary_ambient;
-varying vec3 vary_directional;
-varying vec3 vary_fragcoord;
-varying vec3 vary_pointlight_col;
+VARYING vec3 vary_position;
+VARYING vec3 vary_ambient;
+VARYING vec3 vary_directional;
+VARYING vec3 vary_fragcoord;
+VARYING vec3 vary_pointlight_col;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
 
 uniform float near_clip;
 uniform float shadow_offset;
@@ -88,7 +91,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
 
 void main()
 {
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
+	vary_texcoord0 = texcoord0;
 				
 	vec4 pos;
 	vec3 norm;
@@ -134,9 +137,9 @@ void main()
 	
 	col.rgb = min(col.rgb, 1.0);
 	
-	gl_FrontColor = col;
+	vertex_color = col;
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 	vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl
index d9eafb6ebad..4fc6c00caf0 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl
@@ -30,7 +30,7 @@
 uniform sampler2DRect depthMap;
 uniform sampler2DRect normalMap;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 uniform float depth_cutoff;
 uniform float norm_cutoff;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl
index a84fdd5dc13..11a7cf846d8 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl
@@ -31,7 +31,7 @@
 uniform sampler2DMS depthMap;
 uniform sampler2DMS normalMap;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 uniform float depth_cutoff;
 uniform float norm_cutoff;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl
index 1f5470db3c3..69c6acc07a2 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl
@@ -25,9 +25,9 @@
  
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
+ATTRIBUTE vec3 position;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 uniform vec2 screen_res;
 
 void main()
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
index 4c92d72f441..d1f2db61886 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
@@ -59,7 +59,7 @@ uniform float size;
 uniform vec3 color;
 uniform float falloff;
 
-varying vec4 vary_fragcoord;
+VARYING vec4 vary_fragcoord;
 uniform vec2 screen_res;
 
 uniform mat4 inv_proj;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl
index 1afa9a9fb40..74f78cfc06c 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl
@@ -28,6 +28,8 @@
 #extension GL_ARB_texture_rectangle : enable
 #extension GL_ARB_texture_multisample : enable
 
+VARYING vec4 vertex_color;
+
 uniform sampler2DMS diffuseRect;
 uniform sampler2DMS specularRect;
 uniform sampler2DMS depthMap;
@@ -54,9 +56,9 @@ uniform float sun_wash;
 uniform int proj_shadow_idx;
 uniform float shadow_fade;
 
-varying vec4 vary_light;
+VARYING vec4 vary_light;
 
-varying vec4 vary_fragcoord;
+VARYING vec4 vary_fragcoord;
 uniform vec2 screen_res;
 
 uniform mat4 inv_proj;
@@ -160,7 +162,7 @@ void main()
 			{
 				proj_tc.xyz /= proj_tc.w;
 	
-				float fa = gl_Color.a+1.0;
+				float fa = vertex_color.a+1.0;
 				float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
 				if (dist_atten > 0.0)
 				{
@@ -189,7 +191,7 @@ void main()
 			
 							vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod);
 		
-							vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
+							vec3 lcol = vertex_color.rgb * plcol.rgb * plcol.a;
 			
 							lit = da * dist_atten * noise;
 			
@@ -206,7 +208,7 @@ void main()
 			
 						amb_da = min(amb_da, 1.0-lit);
 			
-						col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
+						col += amb_da*vertex_color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
 					}
 	
 	
@@ -239,7 +241,7 @@ void main()
 									stc.y > 0.0)
 								{
 									vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
-									col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow;
+									col += dist_atten*scol.rgb*vertex_color.rgb*scol.a*spec.rgb*shadow;
 								}
 							}
 						}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 22f52032a58..e9f1a3d3a5d 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -67,7 +67,7 @@ uniform vec2 screen_res;
 
 uniform vec3 sun_dir;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 vec3 vary_PositionEye;
 
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl
index 12442944514..6b979b13ed5 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl
@@ -66,8 +66,8 @@ uniform mat3 ssao_effect_mat;
 uniform mat4 inv_proj;
 uniform vec2 screen_res;
 
-varying vec4 vary_light;
-varying vec2 vary_fragcoord;
+VARYING vec4 vary_light;
+VARYING vec2 vary_fragcoord;
 
 vec3 vary_PositionEye;
 
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
index 424299269fd..c840d727843 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
@@ -25,11 +25,11 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
+ATTRIBUTE vec3 position;
 
 uniform vec2 screen_res;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 void main()
 {
diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
index 25270f49392..19a1d1f1656 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
@@ -27,6 +27,8 @@
 
 #extension GL_ARB_texture_rectangle : enable
 
+VARYING vec4 vertex_color;
+
 uniform sampler2DRect diffuseRect;
 uniform sampler2DRect specularRect;
 uniform sampler2DRect depthMap;
@@ -53,9 +55,9 @@ uniform float sun_wash;
 uniform int proj_shadow_idx;
 uniform float shadow_fade;
 
-varying vec4 vary_light;
+VARYING vec4 vary_light;
 
-varying vec4 vary_fragcoord;
+VARYING vec4 vary_fragcoord;
 uniform vec2 screen_res;
 
 uniform mat4 inv_proj;
@@ -114,7 +116,7 @@ void main()
 	
 	proj_tc.xyz /= proj_tc.w;
 	
-	float fa = gl_Color.a+1.0;
+	float fa = vertex_color.a+1.0;
 	float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
 	
 	lv = proj_origin-pos.xyz;
@@ -140,7 +142,7 @@ void main()
 			
 			vec4 plcol = texture2DLod(projectionMap, proj_tc.xy, lod);
 		
-			vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
+			vec3 lcol = vertex_color.rgb * plcol.rgb * plcol.a;
 			
 			lit = da * dist_atten * noise;
 			
@@ -163,7 +165,7 @@ void main()
 		
 		amb_da = min(amb_da, 1.0-lit);
 		
-		col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
+		col += amb_da*vertex_color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
 	}
 	
 	
@@ -192,7 +194,7 @@ void main()
 					stc.y > 0.0)
 				{
 					vec4 scol = texture2DLod(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
-					col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow;
+					col += dist_atten*scol.rgb*vertex_color.rgb*scol.a*spec.rgb*shadow;
 				}
 			}
 		}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl
index 4962e73e390..85fea56411d 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl
@@ -28,6 +28,8 @@
 #extension GL_ARB_texture_rectangle : enable
 #extension GL_ARB_texture_multisample : enable
 
+VARYING vec4 vertex_color;
+
 uniform sampler2DMS diffuseRect;
 uniform sampler2DMS specularRect;
 uniform sampler2DMS depthMap;
@@ -54,9 +56,9 @@ uniform float sun_wash;
 uniform int proj_shadow_idx;
 uniform float shadow_fade;
 
-varying vec4 vary_light;
+VARYING vec4 vary_light;
 
-varying vec4 vary_fragcoord;
+VARYING vec4 vary_fragcoord;
 uniform vec2 screen_res;
 
 uniform mat4 inv_proj;
@@ -161,7 +163,7 @@ void main()
 			{
 				proj_tc.xyz /= proj_tc.w;
 	
-				float fa = gl_Color.a+1.0;
+				float fa = vertex_color.a+1.0;
 				float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
 				if (dist_atten > 0.0)
 				{
@@ -190,7 +192,7 @@ void main()
 			
 							vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod);
 		
-							vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a;
+							vec3 lcol = vertex_color.rgb * plcol.rgb * plcol.a;
 			
 							lit = da * dist_atten * noise;
 			
@@ -207,7 +209,7 @@ void main()
 			
 						amb_da = min(amb_da, 1.0-lit);
 			
-						col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
+						col += amb_da*vertex_color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
 					}
 	
 	
@@ -240,7 +242,7 @@ void main()
 									stc.y > 0.0)
 								{
 									vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
-									col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow;
+									col += dist_atten*scol.rgb*vertex_color.rgb*scol.a*spec.rgb*shadow;
 								}
 							}
 						}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
index 146fac56e9e..bb742adb629 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
@@ -47,7 +47,7 @@ uniform float ssao_max_radius;
 uniform float ssao_factor;
 uniform float ssao_factor_inv;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 uniform mat4 inv_proj;
 uniform vec2 screen_res;
@@ -97,15 +97,15 @@ float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl)
 	stc.xyz /= stc.w;
 	stc.z += spot_shadow_bias*scl;
 	
-	float cs = shadow2D(shadowMap, stc.xyz).x;
+	float cs = shadow2D(shadowMap, stc.xyz);
 	float shadow = cs;
 
 	vec2 off = 1.5/proj_shadow_res;
 	
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)).x, cs);
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x, cs);
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x, cs);
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x, cs);
+	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)), cs);
+	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)), cs);
+	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)), cs);
+	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)), cs);
 				
 	return shadow/5.0;
 	
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl
index ac4fe526559..4933eb00b77 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl
@@ -48,8 +48,8 @@ uniform float ssao_max_radius;
 uniform float ssao_factor;
 uniform float ssao_factor_inv;
 
-varying vec2 vary_fragcoord;
-varying vec4 vary_light;
+VARYING vec2 vary_fragcoord;
+VARYING vec4 vary_light;
 
 uniform mat4 inv_proj;
 uniform vec2 screen_res;
@@ -98,15 +98,15 @@ float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl)
 	stc.xyz /= stc.w;
 	stc.z += spot_shadow_bias*scl;
 	
-	float cs = shadow2D(shadowMap, stc.xyz).x;
+	float cs = shadow2D(shadowMap, stc.xyz);
 	float shadow = cs;
 
 	vec2 off = 1.5/proj_shadow_res;
 	
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)).x, cs);
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x, cs);
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x, cs);
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x, cs);
+	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)), cs);
+	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)), cs);
+	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)), cs);
+	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)), cs);
 				
 	return shadow/5.0;
 	
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
index 60741771d6b..042bb5f96c1 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
@@ -46,7 +46,7 @@ uniform float ssao_max_radius;
 uniform float ssao_factor;
 uniform float ssao_factor_inv;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 uniform vec3 sun_dir;
 
 uniform mat4 inv_proj;
@@ -148,15 +148,15 @@ float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl)
 	stc.xyz /= stc.w;
 	stc.z += spot_shadow_bias*scl;
 	
-	float cs = shadow2D(shadowMap, stc.xyz).x;
+	float cs = shadow2D(shadowMap, stc.xyz);
 	float shadow = cs;
 
 	vec2 off = 1.5/proj_shadow_res;
 	
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)).x, cs);
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x, cs);
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x, cs);
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x, cs);
+	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)), cs);
+	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)), cs);
+	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)), cs);
+	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)), cs);
 	
 			
 	return shadow/5.0;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl
index 0fd7b7525dc..e138ae58418 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl
@@ -47,8 +47,8 @@ uniform float ssao_max_radius;
 uniform float ssao_factor;
 uniform float ssao_factor_inv;
 
-varying vec2 vary_fragcoord;
-varying vec4 vary_light;
+VARYING vec2 vary_fragcoord;
+VARYING vec4 vary_light;
 
 uniform mat4 inv_proj;
 uniform vec2 screen_res;
@@ -149,15 +149,15 @@ float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl)
 	stc.xyz /= stc.w;
 	stc.z += spot_shadow_bias*scl;
 	
-	float cs = shadow2D(shadowMap, stc.xyz).x;
+	float cs = shadow2D(shadowMap, stc.xyz);
 	float shadow = cs;
 
 	vec2 off = 1.5/proj_shadow_res;
 	
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)).x, cs);
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x, cs);
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x, cs);
-	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x, cs);
+	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)), cs);
+	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)), cs);
+	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)), cs);
+	shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)), cs);
 	
 			
 	return shadow/5.0;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
index 60ba2d7ad4d..bc5eb5181d0 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
@@ -25,9 +25,9 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
+ATTRIBUTE vec3 position;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 uniform vec2 screen_res;
 
diff --git a/indra/newview/app_settings/shaders/class2/effects/blurF.glsl b/indra/newview/app_settings/shaders/class2/effects/blurF.glsl
index 35411db04b3..01fe4a4e14d 100644
--- a/indra/newview/app_settings/shaders/class2/effects/blurF.glsl
+++ b/indra/newview/app_settings/shaders/class2/effects/blurF.glsl
@@ -23,29 +23,5 @@
  * $/LicenseInfo$
  */
  
+//NOT USED!!!
 
-
-uniform sampler2DRect RenderTexture;
-uniform float bloomStrength;
-
-varying vec4 gl_TexCoord[gl_MaxTextureCoords];
-void main(void) 
-{
-	float blurWeights[7];
-	blurWeights[0] = 0.05;
-	blurWeights[1] = 0.1;
-	blurWeights[2] = 0.2;
-	blurWeights[3] = 0.3;
-	blurWeights[4] = 0.2;
-	blurWeights[5] = 0.1;
-	blurWeights[6] = 0.05;
-	
-	vec3 color = vec3(0,0,0);
-	for (int i = 0; i < 7; i++){
-		color += vec3(texture2DRect(RenderTexture, gl_TexCoord[i].st)) * blurWeights[i];
-	}
-
-	color *= bloomStrength;
-
-	gl_FragColor = vec4(color, 1.0);
-}
diff --git a/indra/newview/app_settings/shaders/class2/effects/blurV.glsl b/indra/newview/app_settings/shaders/class2/effects/blurV.glsl
index 4fd4b101ff7..b92e9b3f030 100644
--- a/indra/newview/app_settings/shaders/class2/effects/blurV.glsl
+++ b/indra/newview/app_settings/shaders/class2/effects/blurV.glsl
@@ -23,36 +23,5 @@
  * $/LicenseInfo$
  */
 
-uniform mat4 modelview_projection_matrix;
+ // NOT USED!!
 
-attribute vec3 position;
-attribute vec2 texcoord0;
-
-uniform vec2 texelSize;
-uniform vec2 blurDirection;
-uniform float blurWidth;
-
-void main(void)
-{
-	// Transform vertex
-	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
-	
-	vec2 blurDelta = texelSize * blurDirection * vec2(blurWidth, blurWidth);
-	vec2 s = vec4(texcoord0,0,1).st - (blurDelta * 3.0);
-	
-	// for (int i = 0; i < 7; i++) {
-		// gl_TexCoord[i].st = s + (i * blurDelta);
-	// }
-
-	// MANUALLY UNROLL
-	gl_TexCoord[0].st = s;
-	gl_TexCoord[1].st = s + blurDelta;
-	gl_TexCoord[2].st = s + (2. * blurDelta);
-	gl_TexCoord[3].st = s + (3. * blurDelta);
-	gl_TexCoord[4].st = s + (4. * blurDelta);
-	gl_TexCoord[5].st = s + (5. * blurDelta);
-	gl_TexCoord[6].st = s + (6. * blurDelta);
-
-	// gl_TexCoord[0].st = s;
-	// gl_TexCoord[1].st = blurDelta;
-}
diff --git a/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl b/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl
index 42ab8d40e88..8d673237b84 100644
--- a/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl
+++ b/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl
@@ -36,7 +36,7 @@ const float gamma = 2.0;
 
 void main(void) 
 {
-	vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st));
+	vec3 color = vec3(texture2DRect(RenderTexture, vary_texcoord0.st));
 
 	/// Modulate brightness
 	color *= brightness;
diff --git a/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl b/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl
index d3c93ab05f1..f03a6076c08 100644
--- a/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl
+++ b/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl
@@ -25,15 +25,15 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec2 texcoord0;
-attribute vec2 texcoord1;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec2 texcoord1;
 
 
 void main(void)
 {
 	//transform vertex
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
-	gl_TexCoord[1] = vec4(texcoord1,0,1);
+	vary_texcoord0 = texcoord0;
+	vary_texcoord1 = texcoord1;
 }
diff --git a/indra/newview/app_settings/shaders/class2/effects/extractF.glsl b/indra/newview/app_settings/shaders/class2/effects/extractF.glsl
index 9187c8ec313..06b83e3f5f0 100644
--- a/indra/newview/app_settings/shaders/class2/effects/extractF.glsl
+++ b/indra/newview/app_settings/shaders/class2/effects/extractF.glsl
@@ -33,7 +33,7 @@ uniform vec3 lumWeights;
 void main(void) 
 {
 	/// Get scene color
-	vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st));
+	vec3 color = vec3(texture2DRect(RenderTexture, vary_texcoord0.st));
 	
 	/// Extract luminance and scale up by night vision brightness
 	float lum = smoothstep(extractLow, extractHigh, dot(color, lumWeights));
diff --git a/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl b/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl
index 76b675a9bdf..3050fa63cc8 100644
--- a/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl
+++ b/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl
@@ -30,6 +30,9 @@ uniform sampler2D NoiseTexture;
 uniform float brightMult;
 uniform float noiseStrength;
 
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
+
 float luminance(vec3 color)
 {
 	/// CALCULATING LUMINANCE (Using NTSC lum weights)
@@ -40,7 +43,7 @@ float luminance(vec3 color)
 void main(void) 
 {
 	/// Get scene color
-	vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st));
+	vec3 color = vec3(texture2DRect(RenderTexture, vary_texcoord0.st));
 	
 	/// Extract luminance and scale up by night vision brightness
 	float lum = luminance(color) * brightMult;
@@ -50,7 +53,7 @@ void main(void)
 	vec3 outColor = (lum * vec3(0.91, 1.21, 0.9)) + vec3(-0.07, 0.1, -0.12); 
 
 	/// Add noise
-	float noiseValue = texture2D(NoiseTexture, gl_TexCoord[1].st).r;
+	float noiseValue = texture2D(NoiseTexture, vary_texcoord1.st).r;
 	noiseValue = (noiseValue - 0.5) * noiseStrength;
 
 	/// Older NVG colors (more muted)
diff --git a/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl b/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl
index abf1be6645c..74e9559185b 100644
--- a/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl
+++ b/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl
@@ -27,8 +27,10 @@
 
 uniform sampler2DRect RenderTexture;
 
+VARYING vec2 vary_texcoord0;
+
 void main(void) 
 {
-	vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st));
+	vec3 color = vec3(texture2DRect(RenderTexture, vary_texcoord0.st));
 	gl_FragColor = vec4(1.0 - color, 1.0);
 }
diff --git a/indra/newview/app_settings/shaders/class2/environment/terrainF.glsl b/indra/newview/app_settings/shaders/class2/environment/terrainF.glsl
index df08fce0daa..6b9c6296446 100644
--- a/indra/newview/app_settings/shaders/class2/environment/terrainF.glsl
+++ b/indra/newview/app_settings/shaders/class2/environment/terrainF.glsl
@@ -24,6 +24,9 @@
  */
  
 
+VARYING vec4 vertex_color;
+VARYING vec4 vary_texcoord0;
+VARYING vec4 vary_texcoord1;
 
 uniform sampler2D detail_0;
 uniform sampler2D detail_1;
@@ -40,18 +43,18 @@ void main()
 	/// Note: This should duplicate the blending functionality currently used for the terrain rendering.
 	
 	/// TODO Confirm tex coords and bind them appropriately in vert shader.
-	vec4 color0 = texture2D(detail_0, gl_TexCoord[0].xy);
-	vec4 color1 = texture2D(detail_1, gl_TexCoord[0].xy);
-	vec4 color2 = texture2D(detail_2, gl_TexCoord[0].xy);
-	vec4 color3 = texture2D(detail_3, gl_TexCoord[0].xy);
+	vec4 color0 = texture2D(detail_0, vary_texcoord0.xy);
+	vec4 color1 = texture2D(detail_1, vary_texcoord0.xy);
+	vec4 color2 = texture2D(detail_2, vary_texcoord0.xy);
+	vec4 color3 = texture2D(detail_3, vary_texcoord0.xy);
 
-	float alpha1 = texture2D(alpha_ramp, gl_TexCoord[0].zw).a;
-	float alpha2 = texture2D(alpha_ramp,gl_TexCoord[1].xy).a;
-	float alphaFinal = texture2D(alpha_ramp, gl_TexCoord[1].zw).a;
+	float alpha1 = texture2D(alpha_ramp, vary_texcoord0.zw).a;
+	float alpha2 = texture2D(alpha_ramp,vary_texcoord1.xy).a;
+	float alphaFinal = texture2D(alpha_ramp, vary_texcoord1.zw).a;
 	vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal );
 	
 	/// Add WL Components
-	outColor.rgb = atmosLighting(outColor.rgb * gl_Color.rgb);
+	outColor.rgb = atmosLighting(outColor.rgb * vertex_color.rgb);
 	
 	gl_FragColor = vec4(scaleSoftClip(outColor.rgb), 1.0);
 }
diff --git a/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl
index 69f4d4ae458..f183b885d19 100644
--- a/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl
+++ b/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl
@@ -28,12 +28,18 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
-attribute vec2 texcoord1;
+uniform vec4 object_plane_t;
+uniform vec4 object_plane_s;
 
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec2 texcoord1;
+
+VARYING vec4 vertex_color;
+VARYING vec4 vary_texcoord0;
+VARYING vec4 vary_texcoord1;
 
 void calcAtmospherics(vec3 inPositionEye);
 
@@ -68,15 +74,15 @@ void main()
 
 	vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0));
 	
-	gl_FrontColor = color;
+	vertex_color = color;
 
 	// Transform and pass tex coords
- 	gl_TexCoord[0].xy = texgen_object(vec4(position.xyz, 1.0), vec4(texcoord0,0,1), texture_matrix0, gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy;
+ 	vary_texcoord0.xy = texgen_object(vec4(position.xyz, 1.0), vec4(texcoord0,0,1), texture_matrix0, object_plane_s, object_plane_t).xy;
 	
 	vec4 t = vec4(texcoord1,0,1);
 	
-	gl_TexCoord[0].zw = t.xy;
-	gl_TexCoord[1].xy = t.xy-vec2(2.0, 0.0);
-	gl_TexCoord[1].zw = t.xy-vec2(1.0, 0.0);
+	vary_texcoord0.zw = t.xy;
+	vary_texcoord1.xy = t.xy-vec2(2.0, 0.0);
+	vary_texcoord1.zw = t.xy-vec2(1.0, 0.0);
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/environment/terrainWaterF.glsl b/indra/newview/app_settings/shaders/class2/environment/terrainWaterF.glsl
index 90468b45a22..9f1c4797c98 100644
--- a/indra/newview/app_settings/shaders/class2/environment/terrainWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class2/environment/terrainWaterF.glsl
@@ -23,7 +23,9 @@
  * $/LicenseInfo$
  */
  
-
+VARYING vec4 vertex_color;
+VARYING vec4 vary_texcoord0;
+VARYING vec4 vary_texcoord1;
 
 uniform sampler2D detail_0;
 uniform sampler2D detail_1;
@@ -40,18 +42,18 @@ void main()
 	/// Note: This should duplicate the blending functionality currently used for the terrain rendering.
 	
 	/// TODO Confirm tex coords and bind them appropriately in vert shader.
-	vec4 color0 = texture2D(detail_0, gl_TexCoord[0].xy);
-	vec4 color1 = texture2D(detail_1, gl_TexCoord[0].xy);
-	vec4 color2 = texture2D(detail_2, gl_TexCoord[0].xy);
-	vec4 color3 = texture2D(detail_3, gl_TexCoord[0].xy);
+	vec4 color0 = texture2D(detail_0, vary_texcoord0.xy);
+	vec4 color1 = texture2D(detail_1, vary_texcoord0.xy);
+	vec4 color2 = texture2D(detail_2, vary_texcoord0.xy);
+	vec4 color3 = texture2D(detail_3, vary_texcoord0.xy);
 
-	float alpha1 = texture2D(alpha_ramp, gl_TexCoord[0].zw).a;
-	float alpha2 = texture2D(alpha_ramp,gl_TexCoord[1].xy).a;
-	float alphaFinal = texture2D(alpha_ramp, gl_TexCoord[1].zw).a;
+	float alpha1 = texture2D(alpha_ramp, vary_texcoord0.zw).a;
+	float alpha2 = texture2D(alpha_ramp,vary_texcoord1.xy).a;
+	float alphaFinal = texture2D(alpha_ramp, vary_texcoord1.zw).a;
 	vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal );
 	
 	/// Add WL Components
-	outColor.rgb = atmosLighting(outColor.rgb * gl_Color.rgb);
+	outColor.rgb = atmosLighting(outColor.rgb * vertex_color.rgb);
 	
 	outColor = applyWaterFog(outColor);
 	gl_FragColor = outColor;
diff --git a/indra/newview/app_settings/shaders/class2/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class2/environment/underWaterF.glsl
index f947aa4be10..e4b6402a8cf 100644
--- a/indra/newview/app_settings/shaders/class2/environment/underWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class2/environment/underWaterF.glsl
@@ -48,9 +48,9 @@ uniform float waterFogKS;
 uniform vec2 screenRes;
 
 //bigWave is (refCoord.w, view.w);
-varying vec4 refCoord;
-varying vec4 littleWave;
-varying vec4 view;
+VARYING vec4 refCoord;
+VARYING vec4 littleWave;
+VARYING vec4 view;
 
 vec4 applyWaterFog(vec4 color, vec3 viewVec)
 {
diff --git a/indra/newview/app_settings/shaders/class2/environment/waterF.glsl b/indra/newview/app_settings/shaders/class2/environment/waterF.glsl
index dc543b2231a..0de77e6fe0b 100644
--- a/indra/newview/app_settings/shaders/class2/environment/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class2/environment/waterF.glsl
@@ -47,9 +47,9 @@ uniform float blurMultiplier;
 
 
 //bigWave is (refCoord.w, view.w);
-varying vec4 refCoord;
-varying vec4 littleWave;
-varying vec4 view;
+VARYING vec4 refCoord;
+VARYING vec4 littleWave;
+VARYING vec4 view;
 
 void main() 
 {
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskF.glsl
index 4c053290655..ea17e42fab0 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskF.glsl
@@ -30,9 +30,12 @@ uniform float maximum_alpha;
 vec3 atmosLighting(vec3 light);
 vec3 scaleSoftClip(vec3 light);
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void default_lighting() 
 {
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
 	
 	if (color.a < minimum_alpha || color.a > maximum_alpha)
 	{
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskNonIndexedF.glsl
index 0de909353e1..155d0756bec 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskNonIndexedF.glsl
@@ -33,9 +33,12 @@ uniform sampler2D diffuseMap;
 vec3 atmosLighting(vec3 light);
 vec3 scaleSoftClip(vec3 light);
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void default_lighting() 
 {
-	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color;
 
 	if (color.a < minimum_alpha || color.a > maximum_alpha)
 	{
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl
index d12d88f1c5c..43970015c5b 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl
@@ -23,14 +23,15 @@
  * $/LicenseInfo$
  */
  
-
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 vec3 atmosLighting(vec3 light);
 vec3 scaleSoftClip(vec3 light);
 
 void default_lighting() 
 {
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
 	
 	color.rgb = atmosLighting(color.rgb);
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightAlphaMaskF.glsl
index 8c7713c08db..c6583a54dfd 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightAlphaMaskF.glsl
@@ -29,9 +29,12 @@ uniform float maximum_alpha;
 vec3 fullbrightAtmosTransport(vec3 light);
 vec3 fullbrightScaleSoftClip(vec3 light);
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void fullbright_lighting()
 {
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
 	
 	if (color.a < minimum_alpha || color.a > maximum_alpha)
 	{
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl
index f03b1fdc749..ba2e8608f13 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl
@@ -23,14 +23,15 @@
  * $/LicenseInfo$
  */
  
-
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 vec3 fullbrightAtmosTransport(vec3 light);
 vec3 fullbrightScaleSoftClip(vec3 light);
 
 void fullbright_lighting()
 {
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
 	
 	color.rgb = fullbrightAtmosTransport(color.rgb);
 	
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl
index 89468b96653..76f468d9148 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl
@@ -31,9 +31,12 @@ vec3 fullbrightScaleSoftClip(vec3 light);
 
 uniform sampler2D diffuseMap;
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void fullbright_lighting()
 {
-	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color;
 	
 	if (color.a < minimum_alpha || color.a > maximum_alpha)
 	{
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl
index a909ff608af..e88bf7f0ab0 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl
@@ -23,7 +23,8 @@
  * $/LicenseInfo$
  */
  
-
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 vec3 fullbrightAtmosTransport(vec3 light);
 vec3 fullbrightScaleSoftClip(vec3 light);
@@ -32,7 +33,7 @@ uniform sampler2D diffuseMap;
 
 void fullbright_lighting()
 {
-	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color;
 	
 	color.rgb = fullbrightAtmosTransport(color.rgb);
 	
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl
index d2bc912edb2..045fc5276dd 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl
@@ -23,7 +23,9 @@
  * $/LicenseInfo$
  */
  
-
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
 
 uniform samplerCube environmentMap;
 
@@ -32,17 +34,17 @@ vec3 fullbrightScaleSoftClip(vec3 light);
 
 void fullbright_shiny_lighting()
 {
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy);
-	color.rgb *= gl_Color.rgb;
+	vec4 color = diffuseLookup(vary_texcoord0.xy);
+	color.rgb *= vertex_color.rgb;
 	
-	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	
-	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a);
+	vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;	
+	color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
 
 	color.rgb = fullbrightShinyAtmosTransport(color.rgb);
 
 	color.rgb = fullbrightScaleSoftClip(color.rgb);
 
-	color.a = max(color.a, gl_Color.a);
+	color.a = max(color.a, vertex_color.a);
 
 	gl_FragColor = color;
 }
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl
index af73168c130..93b14ad6921 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl
@@ -23,7 +23,9 @@
  * $/LicenseInfo$
  */
  
-
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
 
 uniform samplerCube environmentMap;
 uniform sampler2D diffuseMap;
@@ -33,17 +35,17 @@ vec3 fullbrightScaleSoftClip(vec3 light);
 
 void fullbright_shiny_lighting()
 {
-	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy);
-	color.rgb *= gl_Color.rgb;
+	vec4 color = texture2D(diffuseMap, vary_texcoord0.xy);
+	color.rgb *= vertex_color.rgb;
 	
-	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	
-	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a);
+	vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;	
+	color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
 
 	color.rgb = fullbrightShinyAtmosTransport(color.rgb);
 
 	color.rgb = fullbrightScaleSoftClip(color.rgb);
 
-	color.a = max(color.a, gl_Color.a);
+	color.a = max(color.a, vertex_color.a);
 
 	gl_FragColor = color;
 }
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl
index e9dab850958..ffc91d9ee10 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl
@@ -23,7 +23,9 @@
  */
  
 
-
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
 
 uniform samplerCube environmentMap;
 
@@ -33,15 +35,15 @@ vec4 applyWaterFog(vec4 color);
 
 void fullbright_shiny_lighting_water()
 {
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy);
-	color.rgb *= gl_Color.rgb;
+	vec4 color = diffuseLookup(vary_texcoord0.xy);
+	color.rgb *= vertex_color.rgb;
 	
-	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	
-	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a);
+	vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;	
+	color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
 
 	color.rgb = fullbrightShinyAtmosTransport(color.rgb);
 	color.rgb = fullbrightScaleSoftClip(color.rgb);
-	color.a = max(color.a, gl_Color.a);
+	color.a = max(color.a, vertex_color.a);
 
 	gl_FragColor = applyWaterFog(color);
 }
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl
index e0a7986705a..3f582d32286 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl
@@ -23,7 +23,9 @@
  */
  
 
-
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
 
 uniform samplerCube environmentMap;
 uniform sampler2D diffuseMap;
@@ -34,15 +36,15 @@ vec4 applyWaterFog(vec4 color);
 
 void fullbright_shiny_lighting_water()
 {
-	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy);
-	color.rgb *= gl_Color.rgb;
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy);
+	color.rgb *= vertex_color.rgb;
 	
-	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	
-	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a);
+	vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;	
+	color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
 
 	color.rgb = fullbrightShinyAtmosTransport(color.rgb);
 	color.rgb = fullbrightScaleSoftClip(color.rgb);
-	color.a = max(color.a, gl_Color.a);
+	color.a = max(color.a, vertex_color.a);
 
 	gl_FragColor = applyWaterFog(color);
 }
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterAlphaMaskF.glsl
index e5998b77a9c..fb2b6420223 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterAlphaMaskF.glsl
@@ -31,9 +31,12 @@ vec4 diffuseLookup(vec2 texcoord);
 vec3 fullbrightAtmosTransport(vec3 light);
 vec4 applyWaterFog(vec4 color);
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void fullbright_lighting_water()
 {
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
 
 	if (color.a < minimum_alpha || color.a > maximum_alpha)
 	{
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl
index 20ff3712af5..258cad3cfe9 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl
@@ -23,7 +23,8 @@
  * $/LicenseInfo$
  */
  
-
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 vec4 diffuseLookup(vec2 texcoord);
 
@@ -32,7 +33,7 @@ vec4 applyWaterFog(vec4 color);
 
 void fullbright_lighting_water()
 {
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
 
 	color.rgb = fullbrightAtmosTransport(color.rgb);
 	
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl
index 3fdd110f7d7..3f2802cbb87 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl
@@ -31,9 +31,12 @@ uniform sampler2D diffuseMap;
 vec3 fullbrightAtmosTransport(vec3 light);
 vec4 applyWaterFog(vec4 color);
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void fullbright_lighting_water()
 {
-	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = texture2D(diffuseMap, vary_texcoord0.xy) * vertex_color;
 
 	if (color.a < minimum_alpha || color.a > maximum_alpha)
 	{
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl
index 01b89019b15..23700fa1b06 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl
@@ -24,6 +24,8 @@
  */
  
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 uniform sampler2D diffuseMap;
 
@@ -32,7 +34,7 @@ vec4 applyWaterFog(vec4 color);
 
 void fullbright_lighting_water()
 {
-	vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = texture2D(diffuseMap, vary_texcoord0.xy) * vertex_color;
 
 	color.rgb = fullbrightAtmosTransport(color.rgb);
 	
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl
index d419c2d116e..09f02b9288f 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl
@@ -23,7 +23,8 @@
  * $/LicenseInfo$
  */
  
-
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 uniform sampler2D diffuseMap;
 
@@ -32,7 +33,7 @@ vec3 scaleSoftClip(vec3 light);
 
 void default_lighting() 
 {
-	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color;
 	
 	color.rgb = atmosLighting(color.rgb);
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl
index ba4cd949d6a..66a2462b88d 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl
@@ -24,7 +24,9 @@
  */
  
 
-
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
 
 uniform samplerCube environmentMap;
 
@@ -34,16 +36,16 @@ vec4 applyWaterFog(vec4 color);
 
 void shiny_lighting()
 {
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy);
-	color.rgb *= gl_Color.rgb;
+	vec4 color = diffuseLookup(vary_texcoord0.xy);
+	color.rgb *= vertex_color.rgb;
 	
-	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	
-	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a);
+	vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;	
+	color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
 
 	color.rgb = atmosLighting(color.rgb);
 
 	color.rgb = scaleSoftClip(color.rgb);
-	color.a = max(color.a, gl_Color.a);
+	color.a = max(color.a, vertex_color.a);
 	gl_FragColor = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl
index 3b30ebf6f14..477408f5afe 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl
@@ -23,8 +23,9 @@
  * $/LicenseInfo$
  */
  
-
-
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
 
 uniform samplerCube environmentMap;
 uniform sampler2D diffuseMap;
@@ -35,16 +36,16 @@ vec4 applyWaterFog(vec4 color);
 
 void shiny_lighting()
 {
-	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy);
-	color.rgb *= gl_Color.rgb;
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy);
+	color.rgb *= vertex_color.rgb;
 	
-	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	
-	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a);
+	vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;	
+	color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
 
 	color.rgb = atmosLighting(color.rgb);
 
 	color.rgb = scaleSoftClip(color.rgb);
-	color.a = max(color.a, gl_Color.a);
+	color.a = max(color.a, vertex_color.a);
 	gl_FragColor = color;
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl
index c451e68763c..6df8641b47a 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl
@@ -24,7 +24,9 @@
  */
  
 
-
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
 
 uniform samplerCube environmentMap;
 
@@ -33,14 +35,14 @@ vec4 applyWaterFog(vec4 color);
 
 void shiny_lighting_water()
 {
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy);
-	color.rgb *= gl_Color.rgb;
+	vec4 color = diffuseLookup(vary_texcoord0.xy);
+	color.rgb *= vertex_color.rgb;
 	
-	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	
-	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a);
+	vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;	
+	color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
 
 	color.rgb = atmosLighting(color.rgb);
-	color.a = max(color.a, gl_Color.a);
+	color.a = max(color.a, vertex_color.a);
 	gl_FragColor = applyWaterFog(color);
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl
index eeb997fb5f7..fce717d93af 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl
@@ -24,7 +24,9 @@
  */
  
 
-
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
 
 uniform sampler2D diffuseMap;
 uniform samplerCube environmentMap;
@@ -34,14 +36,14 @@ vec4 applyWaterFog(vec4 color);
 
 void shiny_lighting_water()
 {
-	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy);
-	color.rgb *= gl_Color.rgb;
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy);
+	color.rgb *= vertex_color.rgb;
 	
-	vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb;	
-	color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a);
+	vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;	
+	color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
 
 	color.rgb = atmosLighting(color.rgb);
-	color.a = max(color.a, gl_Color.a);
+	color.a = max(color.a, vertex_color.a);
 	gl_FragColor = applyWaterFog(color);
 }
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskF.glsl
index 072dcaa6b65..4658b46a389 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskF.glsl
@@ -29,9 +29,12 @@ uniform float maximum_alpha;
 vec3 atmosLighting(vec3 light);
 vec4 applyWaterFog(vec4 color);
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void default_lighting_water()
 {
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
 
 	if (color.a < minimum_alpha || color.a > maximum_alpha)
 	{
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskNonIndexedF.glsl
index 2df34da4b47..0db9253cd15 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskNonIndexedF.glsl
@@ -31,9 +31,12 @@ uniform sampler2D diffuseMap;
 vec3 atmosLighting(vec3 light);
 vec4 applyWaterFog(vec4 color);
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
 void default_lighting_water()
 {
-	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color;
 
 	if (color.a < minimum_alpha || color.a > maximum_alpha)
 	{
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl
index ae7be4d231d..a691d4f54a0 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl
@@ -24,13 +24,15 @@
  */
  
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 vec3 atmosLighting(vec3 light);
 vec4 applyWaterFog(vec4 color);
 
 void default_lighting_water()
 {
-	vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
 
 	color.rgb = atmosLighting(color.rgb);
 
diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl
index 5a86dad8278..6f5d6cd1c8c 100644
--- a/indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl
@@ -24,6 +24,8 @@
  */
  
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 uniform sampler2D diffuseMap;
 
@@ -32,7 +34,7 @@ vec4 applyWaterFog(vec4 color);
 
 void default_lighting_water()
 {
-	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color;
 
 	color.rgb = atmosLighting(color.rgb);
 
diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl
index b9eff87a13b..ef97e4f781f 100644
--- a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl
@@ -34,12 +34,17 @@ void calcAtmospherics(vec3 inPositionEye);
 
 uniform vec4 origin;
 
-varying float vary_texture_index;
+VARYING float vary_texture_index;
 
-attribute vec4 position;
-attribute vec3 normal;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec4 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
+VARYING float fog_depth;
 
 void main()
 {
@@ -52,12 +57,12 @@ void main()
 	vec3 norm = normalize(normal_matrix * normal);
 	vec3 ref = reflect(pos.xyz, -norm);
 
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
-	gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	vary_texcoord1 = (texture_matrix1*vec4(ref,1.0)).xyz;
 
 	calcAtmospherics(pos.xyz);
 
-	gl_FrontColor = diffuse_color;
+	vertex_color = diffuse_color;
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl
index b7f7af7885b..2fd22cee9da 100644
--- a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl
@@ -27,15 +27,18 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
  
-attribute vec4 position;
-attribute vec2 texcoord0;
-attribute vec3 normal;
-attribute vec4 diffuse_color;
+ATTRIBUTE vec4 position;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
 
 
 void calcAtmospherics(vec3 inPositionEye);
 
-varying float vary_texture_index;
+VARYING float vary_texture_index;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
 
 void main()
 {
@@ -44,11 +47,11 @@ void main()
 	vary_texture_index = position.w;
 	vec4 pos = (modelview_matrix * vert);
 	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
 	
 	calcAtmospherics(pos.xyz);
 
-	gl_FrontColor = diffuse_color;
+	vertex_color = diffuse_color;
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl
index 4511c4bc91d..472ff219e5b 100644
--- a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl
@@ -29,16 +29,21 @@ uniform mat4 texture_matrix1;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec4 position;
-attribute vec2 texcoord0;
-attribute vec3 normal;
-attribute vec4 diffuse_color;
+ATTRIBUTE vec4 position;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 
 void calcAtmospherics(vec3 inPositionEye);
 
-varying float vary_texture_index;
+VARYING float vary_texture_index;
+VARYING float fog_depth;
 
 uniform vec4 origin;
 
@@ -53,12 +58,12 @@ void main()
 	vec3 norm = normalize(normal_matrix * normal);
 	vec3 ref = reflect(pos.xyz, -norm);
 
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);
-	gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	vary_texcoord1 = (texture_matrix1*vec4(ref,1.0)).xyz;
 
 	calcAtmospherics(pos.xyz);
 
-	gl_FrontColor = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.0));
+	vertex_color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.0));
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl
index 5f78495ae36..6799e43b9a3 100644
--- a/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl
@@ -28,10 +28,14 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec2 texcoord0;
-attribute vec3 normal;
-attribute vec4 diffuse_color;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
@@ -42,7 +46,7 @@ void main()
 	vec4 vert = vec4(position.xyz,1.0);
 	
 	gl_Position = modelview_projection_matrix*vert;
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy;
 	
 	vec4 pos = (modelview_matrix * vert);
 	
@@ -51,7 +55,7 @@ void main()
 	calcAtmospherics(pos.xyz);
 
 	vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
-	gl_FrontColor = color;
+	vertex_color = color;
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl
index 91ee5e016e0..144336417e9 100644
--- a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl
+++ b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl
@@ -28,15 +28,18 @@ uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 uniform mat4 modelview_projection_matrix;
 
-attribute vec4 position;
-attribute vec2 texcoord0;
-attribute vec3 normal;
-attribute vec4 diffuse_color;
+ATTRIBUTE vec4 position;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
 
-varying float vary_texture_index;
+VARYING float vary_texture_index;
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING float fog_depth;
 
 void main()
 {
@@ -45,7 +48,7 @@ void main()
 	vary_texture_index = position.w;
 	vec4 pos = (modelview_matrix * vert);
 	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
-	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1);
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy;
 	
 	
 	
@@ -54,7 +57,7 @@ void main()
 	calcAtmospherics(pos.xyz);
 
 	vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
-	gl_FrontColor = color;
+	vertex_color = color;
 
-	gl_FogFragCoord = pos.z;
+	fog_depth = pos.z;
 }
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
index be990c17579..6a83be1426d 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
@@ -25,7 +25,7 @@
  
 
 
-// varying param funcs
+// VARYING param funcs
 void setSunlitColor(vec3 v);
 void setAmblitColor(vec3 v);
 void setAdditiveColor(vec3 v);
@@ -34,8 +34,8 @@ void setPositionEye(vec3 v);
 
 vec3 getAdditiveColor();
 
-//varying vec4 vary_CloudUVs;
-//varying float vary_CloudDensity;
+//VARYING vec4 vary_CloudUVs;
+//VARYING float vary_CloudDensity;
 
 // Inputs
 uniform vec4 morphFactor;
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl
index a98c04b2593..08814b49d85 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl
@@ -25,12 +25,12 @@
  
 
 
-varying vec3 vary_PositionEye;
+VARYING vec3 vary_PositionEye;
 
-varying vec3 vary_SunlitColor;
-varying vec3 vary_AmblitColor;
-varying vec3 vary_AdditiveColor;
-varying vec3 vary_AtmosAttenuation;
+VARYING vec3 vary_SunlitColor;
+VARYING vec3 vary_AmblitColor;
+VARYING vec3 vary_AdditiveColor;
+VARYING vec3 vary_AtmosAttenuation;
 
 vec3 getPositionEye()
 {
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl
index 7c3cb88b3ce..514f009adde 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl
@@ -25,12 +25,12 @@
  
 
 
-varying vec3 vary_PositionEye;
+VARYING vec3 vary_PositionEye;
 
-varying vec3 vary_SunlitColor;
-varying vec3 vary_AmblitColor;
-varying vec3 vary_AdditiveColor;
-varying vec3 vary_AtmosAttenuation;
+VARYING vec3 vary_SunlitColor;
+VARYING vec3 vary_AmblitColor;
+VARYING vec3 vary_AdditiveColor;
+VARYING vec3 vary_AtmosAttenuation;
 
 vec3 getPositionEye()
 {
diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl
index b90cec119b7..ea60d1df6cd 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl
@@ -29,9 +29,13 @@
 // The fragment shader for the sky
 /////////////////////////////////////////////////////////////////////////
 
-varying vec4 vary_CloudColorSun;
-varying vec4 vary_CloudColorAmbient;
-varying float vary_CloudDensity;
+VARYING vec4 vary_CloudColorSun;
+VARYING vec4 vary_CloudColorAmbient;
+VARYING float vary_CloudDensity;
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
+VARYING vec2 vary_texcoord2;
+VARYING vec2 vary_texcoord3;
 
 uniform sampler2D cloud_noise_texture;
 uniform vec4 cloud_pos_density1;
@@ -50,14 +54,14 @@ vec3 scaleSoftClip(vec3 light) {
 void main()
 {
 	// Set variables
-	vec2 uv1 = gl_TexCoord[0].xy;
-	vec2 uv2 = gl_TexCoord[1].xy;
+	vec2 uv1 = vary_texcoord0.xy;
+	vec2 uv2 = vary_texcoord1.xy;
 
 	vec4 cloudColorSun = vary_CloudColorSun;
 	vec4 cloudColorAmbient = vary_CloudColorAmbient;
 	float cloudDensity = vary_CloudDensity;
-	vec2 uv3 = gl_TexCoord[2].xy;
-	vec2 uv4 = gl_TexCoord[3].xy;
+	vec2 uv3 = vary_texcoord2.xy;
+	vec2 uv4 = vary_texcoord3.xy;
 
 	// Offset texture coords
 	uv1 += cloud_pos_density1.xy;	//large texture, visible density
diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
index 67b5e7fb837..c5bb52169cc 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
@@ -25,17 +25,21 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
 
 //////////////////////////////////////////////////////////////////////////
 // The vertex shader for creating the atmospheric sky
 ///////////////////////////////////////////////////////////////////////////////
 
 // Output parameters
-varying vec4 vary_CloudColorSun;
-varying vec4 vary_CloudColorAmbient;
-varying float vary_CloudDensity;
+VARYING vec4 vary_CloudColorSun;
+VARYING vec4 vary_CloudColorAmbient;
+VARYING float vary_CloudDensity;
+VARYING vec2 vary_texcoord0;
+VARYING vec2 vary_texcoord1;
+VARYING vec2 vary_texcoord2;
+VARYING vec2 vary_texcoord3;
 
 // Inputs
 uniform vec3 camPosLocal;
@@ -64,7 +68,7 @@ void main()
 	// World / view / projection
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
 
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
+	vary_texcoord0 = texcoord0;
 
 	// Get relative position
 	vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
@@ -163,17 +167,17 @@ void main()
 
 
 	// Texture coords
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
-	gl_TexCoord[0].xy -= 0.5;
-	gl_TexCoord[0].xy /= cloud_scale.x;
-	gl_TexCoord[0].xy += 0.5;
+	vary_texcoord0 = texcoord0;
+	vary_texcoord0.xy -= 0.5;
+	vary_texcoord0.xy /= cloud_scale.x;
+	vary_texcoord0.xy += 0.5;
 
-	gl_TexCoord[1] = gl_TexCoord[0];
-	gl_TexCoord[1].x += lightnorm.x * 0.0125;
-	gl_TexCoord[1].y += lightnorm.z * 0.0125;
+	vary_texcoord1 = vary_texcoord0;
+	vary_texcoord1.x += lightnorm.x * 0.0125;
+	vary_texcoord1.y += lightnorm.z * 0.0125;
 
-	gl_TexCoord[2] = gl_TexCoord[0] * 16.;
-	gl_TexCoord[3] = gl_TexCoord[1] * 16.;
+	vary_texcoord2 = vary_texcoord0 * 16.;
+	vary_texcoord3 = vary_texcoord1 * 16.;
 
 	// Combine these to minimize register use
 	vary_CloudColorAmbient += oHazeColorBelowCloud;
diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl
index ac569e82578..5c9ee5fd63c 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl
@@ -29,7 +29,7 @@
 // The fragment shader for the sky
 /////////////////////////////////////////////////////////////////////////
 
-varying vec4 vary_HazeColor;
+VARYING vec4 vary_HazeColor;
 
 uniform sampler2D cloud_noise_texture;
 uniform vec4 gamma;
diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
index 50fdba64c25..b768cc9cf36 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
@@ -25,15 +25,16 @@
  
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
 
 // SKY ////////////////////////////////////////////////////////////////////////
 // The vertex shader for creating the atmospheric sky
 ///////////////////////////////////////////////////////////////////////////////
 
 // Output parameters
-varying vec4 vary_HazeColor;
+VARYING vec4 vary_HazeColor;
+VARYING vec2 vary_texcoord0;
 
 // Inputs
 uniform vec3 camPosLocal;
@@ -61,7 +62,7 @@ void main()
 
 	// World / view / projection
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
+	vary_texcoord0 = texcoord0;
 
 	// Get relative position
 	vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0);
diff --git a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl
index c10635c898c..9a14d496e9c 100644
--- a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl
+++ b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl
@@ -25,10 +25,13 @@
 
 uniform mat4 projection_matrix;
 
-attribute vec3 position;
-attribute vec3 normal;
-attribute vec2 texcoord0;
-attribute vec4 clothing; 
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec2 texcoord0;
+ATTRIBUTE vec4 clothing; 
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 mat4 getSkinnedTransform();
@@ -43,7 +46,7 @@ const vec4 gPiConstants	= vec4(0.159154943, 6.28318530, 3.141592653, 1.5707963);
 
 void main()
 {
-	gl_TexCoord[0] = vec4(texcoord0,0,1);
+	vary_texcoord0 = texcoord0;
 		
 	vec4 pos;
 	mat4 trans = getSkinnedTransform();
@@ -123,11 +126,11 @@ void main()
 	calcAtmospherics(pos.xyz);
 	
 	vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.0));			
-	gl_FrontColor = color; 
+	vertex_color = color; 
 					
 	gl_Position = projection_matrix * pos;
 	
 	
-	gl_TexCoord[2] = vec4(pos.xyz, 1.0);
+	vary_texcoord2 = vec4(pos.xyz, 1.0);
 
 }
diff --git a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl
index 616ea5fe9e7..eb9256b41b5 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl
@@ -35,7 +35,7 @@ uniform int kern_length;
 uniform float kern_scale;
 uniform vec3 blur_quad;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 uniform mat4 inv_proj;
 uniform vec2 screen_res;
diff --git a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl
index 5e75aec171d..380d5207c30 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl
@@ -25,9 +25,9 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
+ATTRIBUTE vec3 position;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 uniform vec2 screen_res;
 
 void main()
diff --git a/indra/newview/app_settings/shaders/class3/deferred/giF.glsl b/indra/newview/app_settings/shaders/class3/deferred/giF.glsl
index 95913a502c4..ba1d29b044a 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/giF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/giF.glsl
@@ -42,7 +42,7 @@ uniform sampler2D		depthGIMap;
 uniform sampler2D		lightFunc;
 
 // Inputs
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 uniform vec2 screen_res;
 
diff --git a/indra/newview/app_settings/shaders/class3/deferred/giFinalF.glsl b/indra/newview/app_settings/shaders/class3/deferred/giFinalF.glsl
index 7c55fcc2864..e3d5fdcf106 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/giFinalF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/giFinalF.glsl
@@ -32,7 +32,7 @@ uniform sampler2D	  bloomMap;
 uniform sampler2DRect edgeMap;
 
 uniform vec2 screen_res;
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 
 void main() 
diff --git a/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl
index 969b6e2f1c0..60eca06d356 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl
@@ -25,10 +25,10 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
+ATTRIBUTE vec3 position;
 
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 uniform vec2 screen_res;
 
 void main()
diff --git a/indra/newview/app_settings/shaders/class3/deferred/giV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giV.glsl
index 2766691bd02..8272dbf31bb 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/giV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/giV.glsl
@@ -25,12 +25,13 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec4 diffuse_color;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
 
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
+VARYING vec4 vertex_color;
 
 uniform vec2 screen_res;
 
@@ -44,5 +45,5 @@ void main()
 	vec4 tex = vec4(texcoord0,0,1);
 	tex.w = 1.0;
 
-	gl_FrontColor = diffuse_color;
+	vertex_color = diffuse_color;
 }
diff --git a/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl
index 13517a26bac..7c290fc993c 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl
@@ -30,7 +30,7 @@
 uniform sampler2DRect lightMap;
 uniform sampler2DRect diffuseRect;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 void main() 
 {
 	float i = texture2DRect(lightMap, vary_fragcoord.xy).r;
diff --git a/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl
index d0205fa824c..062875e72ff 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl
@@ -25,12 +25,13 @@
 
 uniform mat4 modelview_projection_matrix;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
+VARYING vec4 vertex_color;
 
 uniform vec2 screen_res;
 
-attribute vec3 position;
-attribute vec4 diffuse_color;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec4 diffuse_color;
 
 void main()
 {
@@ -40,5 +41,5 @@ void main()
 	
 	vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;	
 
-	gl_FrontColor = diffuse_color;
+	vertex_color = diffuse_color;
 }
diff --git a/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl
index 0364da62584..662f5fb6bec 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl
@@ -53,7 +53,7 @@ uniform float gi_luminance;
 uniform vec4 sunlight_color;
 
 uniform vec2 screen_res;
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 void main() 
 {
diff --git a/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl
index 2d7fa22edcb..0049d8ea78c 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl
@@ -25,9 +25,9 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
+ATTRIBUTE vec3 position;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 uniform vec2 screen_res;
 
 void main()
diff --git a/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl b/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl
index 009b5cc7439..ecab3baeee9 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl
@@ -40,7 +40,7 @@ uniform float kern_scale;
 uniform float gi_edge_weight;
 uniform float gi_blur_brightness;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 
 void main() 
 {
diff --git a/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl b/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl
index e9c6f3e27b8..6d590c8051d 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl
@@ -25,9 +25,9 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
+ATTRIBUTE vec3 position;
 
-varying vec2 vary_fragcoord;
+VARYING vec2 vary_fragcoord;
 uniform vec2 screen_res;
 
 void main()
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index 1c02adea89b..664cec64c31 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -65,8 +65,8 @@ uniform sampler2DRect depthMap;
 uniform mat4 inv_proj;
 uniform vec2 screen_res;
 
-varying vec4 vary_light;
-varying vec2 vary_fragcoord;
+VARYING vec4 vary_light;
+VARYING vec2 vary_fragcoord;
 
 vec3 vary_PositionEye;
 
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl
index 8e405de9a3d..682508aaf38 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl
@@ -25,13 +25,13 @@
 
 uniform mat4 modelview_projection_matrix;
 
-attribute vec3 position;
-attribute vec2 texcoord0;
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
 
 uniform vec2 screen_res;
 
-varying vec4 vary_light;
-varying vec2 vary_fragcoord;
+VARYING vec4 vary_light;
+VARYING vec2 vary_fragcoord;
 void main()
 {
 	//transform vertex
diff --git a/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl
index 56a149523e0..80e08e8270f 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl
@@ -24,15 +24,17 @@
  */
  
 
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
 
 uniform sampler2D diffuseMap;
 
-varying vec3 vary_normal;
+VARYING vec3 vary_normal;
 
 void main() 
 {
-	vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy);
-	gl_FragData[0] = vec4(gl_Color.rgb*col.rgb, col.a <= 0.5 ? 0.0 : 0.005);
+	vec4 col = texture2D(diffuseMap, vary_texcoord0.xy);
+	gl_FragData[0] = vec4(vertex_color.rgb*col.rgb, col.a <= 0.5 ? 0.0 : 0.005);
 	gl_FragData[1] = vec4(0,0,0,0);
 	vec3 nvn = normalize(vary_normal);
 	gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0);
diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp
index 3ba4a89686b..cac8439eb82 100644
--- a/indra/newview/lldrawpoolterrain.cpp
+++ b/indra/newview/lldrawpoolterrain.cpp
@@ -316,13 +316,12 @@ void LLDrawPoolTerrain::renderFullShader()
 	gGL.getTexUnit(detail0)->bind(detail_texture0p);
 	gGL.getTexUnit(0)->activate();
 
-	glEnable(GL_TEXTURE_GEN_S);
-	glEnable(GL_TEXTURE_GEN_T);
-	glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
-	glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+	LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+	llassert(shader);
+		
+	shader->uniform4fv("object_plane_s", 1, tp0.mV);
+	shader->uniform4fv("object_plane_t", 1, tp1.mV);
 
-	glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
-	glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
 	gGL.matrixMode(LLRender::MM_TEXTURE);
 	gGL.loadIdentity();
 	gGL.matrixMode(LLRender::MM_MODELVIEW);
-- 
GitLab