summaryrefslogtreecommitdiff
path: root/example/fragmentshader.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'example/fragmentshader.glsl')
-rw-r--r--example/fragmentshader.glsl8
1 files changed, 7 insertions, 1 deletions
diff --git a/example/fragmentshader.glsl b/example/fragmentshader.glsl
index 70c55b5..6e8c4c5 100644
--- a/example/fragmentshader.glsl
+++ b/example/fragmentshader.glsl
@@ -2,11 +2,15 @@
out vec4 outpix;
uniform vec3 campos;
uniform vec3 lightpos;
+uniform sampler2D tex;
+uniform sampler2D elev;
//varing blends them it is transformed to world space
varying vec4 fragpos;
varying vec4 fragnormal;
+varying vec2 fragtexcoord;
void main()
{
+ vec4 elevpix = texture(elev, fragtexcoord);
vec3 lightnormal = normalize((lightpos - vec3(fragpos.x, fragpos.y, fragpos.z)));
float diffuse = dot(lightnormal, vec3(fragnormal.x, fragnormal.y, fragnormal.z));
if (diffuse < 0.0) {
@@ -17,9 +21,11 @@ void main()
diffuse = pow(diffuse, 2.0);
reflect = pow(reflect, 2.0);
float light = .4 * reflect + .6 * diffuse;
+ vec4 texpix = texture(tex, fragtexcoord);
//this should be the vertex in camera space without the w value
//outpix = gl_FragCoord;
- outpix = vec4(light * 1.0,light * 1.0,light * 1.0, 1.0);
+ outpix = texpix;
+ //outpix = vec4(light * 1.0,light * 1.0,light * 1.0, 1.0);
//outpix = vec4(fragpos.x ,fragpos.y ,fragpos.z, 0.5);
//outpix = vec4(fragnormal.x, fragnormal.y, fragnormal.z, 0.5);
}