varying vec3 pos;
varying vec3 normal;
varying vec3 ldir;
-varying vec3 tex_coord;
+varying vec2 tex_coord;
-layout(location = 0) out vec4 color;
+out vec4 color;
void main()
{
float cdiff = max(dot(l, n), 0.0);
float cspec = pow(max(dot(r, vdir), 0.0), shininess);
- color = diffuse * cdiff * texture2D(tex, tex_coord.xy) + specular * cspec;
+ vec4 texel = texture2D(tex, tex_coord);
+ color.xyz = diffuse.xyz * cdiff * texel.xyz + specular.xyz * cspec;
+ color.w = 1.0;
}