   	matViewT[0][2] = -matViewT[0][2];
  	matViewT[1][2] = -matViewT[1][2];
   	matViewT[2][2] = -matViewT[2][2];
- 	vReflect = (matViewT * vec4(vReflect, 1.0)).xyz;
+ 	vReflect = (mat3(matViewT) * vReflect);
 
  	vReflect = (mTexture * vec4(vReflect, 1.0)).xyz;
- 	
+	vReflect.z = -vReflect.z; // Hack for gl 
+
 	vOut = vReflect;
 }
 

						   in vec3 vNormal,
						   out vec3 vOut)
{
	vec3 vWorldNormal = (mWorldIT * vec4(vNormal, 1.0)).xyz;
	vec3 vViewNormal  = (mView * vec4(vWorldNormal, 1.0)).xyz;
	
	vOut = (mTexture * vec4(vViewNormal, 1.0)).xyz;
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Sphere(in 	mat4 mWorld,
										in 	mat4 mView,
										in 	mat4 mWorldIT,
										in 	vec4 vPos,
										in 	vec3 vNormal,
										out vec2 vOut)
{
	mat4 worldview = mView * mWorld;
	vec3 normal = normalize( (mWorldIT * vec4(vNormal,0.0)).xyz); 
	vec3 eyedir =  normalize(worldview * vPos).xyz;
	vec3 r = reflect(eyedir, normal);
	float two_p = 2.0 * sqrt( r.x *  r.x +  r.y *  r.y +  (r.z + 1) *  (r.z + 1));
	vOut = vec2(0.5 + r.x / two_p,0.5 - r.y / two_p);
}
//-----------------------------------------------------------------------------
void FFP_GenerateTexCoord_EnvMap_Sphere(in 	mat4 mWorld,

						   in vec3 vNormal,
						   out vec3 vOut)
{
	vec3 vWorldNormal = (mat3(mWorldIT) * vNormal);
	vec3 vViewNormal  = (mat3(mView) * vWorldNormal);

	vOut = vViewNormal;
}
