varying vec4 ViewPos;
varying vec3 ViewPos3;

void main()
{
 ViewPos  = gl_ModelViewMatrix * gl_Vertex;
 ViewPos3 = (vec3(ViewPos))/ViewPos.w;

 gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
 gl_TexCoord[1] = gl_MultiTexCoord0;
 
 gl_FogFragCoord = abs(ViewPos.z);
// gl_FogFragCoord = length(ViewPos);

 gl_Position = ftransform();
}

