aboutsummaryrefslogtreecommitdiffstats
path: root/progs/glsl/cubemap.frag.txt
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-02-03 11:36:16 -0700
committerBrian <[email protected]>2007-02-03 11:36:16 -0700
commitedf24e699ea75660eee0a62456ab2cbadf1b489f (patch)
tree45bee2dd5e0cd7f3e701322384c551fe8026f11b /progs/glsl/cubemap.frag.txt
parent00d63aafc6d938f13acc9b136ff210fb0bbb15f9 (diff)
shading language texture demo/test
Diffstat (limited to 'progs/glsl/cubemap.frag.txt')
-rw-r--r--progs/glsl/cubemap.frag.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/progs/glsl/cubemap.frag.txt b/progs/glsl/cubemap.frag.txt
new file mode 100644
index 00000000000..9c27648aaf9
--- /dev/null
+++ b/progs/glsl/cubemap.frag.txt
@@ -0,0 +1,18 @@
+// Fragment shader for cube-texture reflection mapping
+// Brian Paul
+
+
+uniform samplerCube cubeTex;
+varying vec3 normal;
+uniform vec3 lightPos;
+
+void main()
+{
+ // simple diffuse, specular lighting:
+ vec3 lp = normalize(lightPos);
+ float dp = dot(lp, normalize(normal));
+ float spec = pow(dp, 5.0);
+
+ // final color:
+ gl_FragColor = dp * textureCube(cubeTex, gl_TexCoord[0].xyz, 0.0) + spec;
+}