diff options
author | knolax <1339802534.kk@gmail.com> | 2017-02-28 11:05:31 -0500 |
---|---|---|
committer | knolax <1339802534.kk@gmail.com> | 2017-02-28 11:05:31 -0500 |
commit | cf3f284a5f24bd02006e9ff929cc29d10c428a3e (patch) | |
tree | e23fabd9a851ffdce0b48783c1903f40b6bfe573 /example/fragmentshader.glsl | |
parent | 0c2c626fbdfd7836f086eb8f4039a394368b7974 (diff) |
textures loaded properly now but without functional alpha layer.
Diffstat (limited to 'example/fragmentshader.glsl')
-rw-r--r-- | example/fragmentshader.glsl | 8 |
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); } |