terrain working - no culling
[demo] / gl_shaders / default.f.glsl
index 388ba76..490efab 100644 (file)
@@ -9,9 +9,9 @@ uniform float shininess;
 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()
 {
@@ -25,5 +25,7 @@ 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;
 }