Affine-looking texture mapping on intel card?

I am running arch linux with an intel 950gma for my graphics card. The card does support GLSL mostly, but for some reason, this particular shader (normal mapping) causes the textures to look affine. Other shaders work, and even different normal mapping shaders work, so I’m not sure what the problem with this one is. I didn’t write it, as I got it from a tutorial, so can someone with a bit more experience tell me if this is a problem with the shader or a hardware limitation?
Here is the vertex shader:

uniform vec3 light_position;

attribute vec3 tangent; 

varying vec3 light_direction; 
varying vec3 eye_direction;
varying vec2 texCoord;

void main()
   gl_Position = ftransform();
   texCoord = gl_MultiTexCoord0.xy;

   vec3 n = normalize(gl_NormalMatrix * gl_Normal);
   vec3 t = normalize(gl_NormalMatrix * tangent);
   vec3 b = cross(n, t);

   vec3 vVertex = vec3(gl_ModelViewMatrix * gl_Vertex);
   vec3 tmp = light_position - vVertex;

   light_direction.x = dot(tmp, t);
   light_direction.y = dot(tmp, b);
   light_direction.z = dot(tmp, n);

   tmp = -vVertex;
   eye_direction.x = dot(tmp, t);
   eye_direction.y = dot(tmp, b);
   eye_direction.z = dot(tmp, n);

And the fragment shader:

varying vec3 light_direction; 
varying vec3 eye_direction;
varying vec2 texCoord;

uniform vec3 light; // Light Colour;
uniform vec3 ambient;
uniform vec3 specular;
uniform float exponent;

uniform sampler2D colour_map;
uniform sampler2D normal_map;

void main()
   float inverse_radius = 0.00125;

   float distance_sqr = dot(light_direction, light_direction);
   float att = clamp(1.0 - inverse_radius * sqrt(distance_sqr), 0.0, 1.0);

   vec3 l = light_direction * inversesqrt(distance_sqr);
   vec3 v = normalize(eye_direction);

   vec3 base = texture2D(colour_map, texCoord).xyz;
   vec3 bump = normalize(texture2D(normal_map, texCoord).xyz * 2.0 - 1.0);

   float d = dot(l, bump);
   float r = dot(reflect(-l, bump), v);

   vec3 color =  base * (ambient + light * max(0.0, d)) /* Ambient lighting. */;
        color += light * specular * pow(clamp(r, 0.0, 1.0), exponent); /* Phong exponent. */

   gl_FragColor = vec4(color, 0.0) * att;

Thank you in advance to whomever can help me with this.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.