summaryrefslogtreecommitdiff
path: root/slideshow/opengl/basicFragmentShader.glsl
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>2015-11-23 21:53:22 +0000
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2015-11-23 23:06:39 +0100
commit6bc132f8bf85516b4a89386c371fdd3e9937b4bf (patch)
treefb20dff8d0ffccbb6cdeb8c9a04d4d8ae3f89e5c /slideshow/opengl/basicFragmentShader.glsl
parentb8eff3afb4a4b313c9be668951ae2cb458cd6a4a (diff)
slideshow: Add back lighting in the SimpleTransition shaders
Change-Id: Iec854a8369a7a9f845f261233e46aea8097db109
Diffstat (limited to 'slideshow/opengl/basicFragmentShader.glsl')
-rw-r--r--slideshow/opengl/basicFragmentShader.glsl8
1 files changed, 6 insertions, 2 deletions
diff --git a/slideshow/opengl/basicFragmentShader.glsl b/slideshow/opengl/basicFragmentShader.glsl
index 7744432f0bcf..01d72a260ca0 100644
--- a/slideshow/opengl/basicFragmentShader.glsl
+++ b/slideshow/opengl/basicFragmentShader.glsl
@@ -30,10 +30,14 @@
uniform sampler2D slideTexture;
varying vec2 v_texturePosition;
+varying vec3 v_normal;
void main() {
- // TODO: handle lighting.
- gl_FragColor = texture2D(slideTexture, v_texturePosition);
+ vec3 lightVector = vec3(0.0, 0.0, 1.0);
+ float light = max(dot(lightVector, v_normal), 0.0);
+ vec4 fragment = texture2D(slideTexture, v_texturePosition);
+ vec4 black = vec4(0.0, 0.0, 0.0, fragment.a);
+ gl_FragColor = mix(black, fragment, light);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */