Textures are now supported

This commit is contained in:
Thomas FORGIONE
2016-11-30 10:08:37 +01:00
parent 7a9e1a741e
commit 8d31b13da7
4 changed files with 34 additions and 8 deletions

View File

@@ -4,6 +4,7 @@ vec3 ambientLight = vec3(0.2,0.2,0.2);
vec3 directionnalLight = normalize(vec3(10,5,7));
vec3 directionnalLightFactor = vec3(0.5,0.5,0.5);
uniform sampler2D tex;
void main() {
@@ -11,5 +12,11 @@ void main() {
vec3 lambertFactor = max(vec3(0.0,0.0,0.0), dot(directionnalLight, fNormal) * directionnalLightFactor);
vec4 texel = texture2D(tex, gl_TexCoord[0].xy);
gl_FragColor = vec4(ambientFactor + lambertFactor, 1.0);
vec4 noTexColor = vec4(ambientFactor + lambertFactor, 1.0);
vec4 color = texture2D(tex,gl_TexCoord[0].st);
vec4 fragColor = noTexColor * color;
gl_FragColor = fragColor;
}