summaryrefslogtreecommitdiff
path: root/progs/fpglsl/tex-multi.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'progs/fpglsl/tex-multi.glsl')
-rw-r--r--progs/fpglsl/tex-multi.glsl15
1 files changed, 15 insertions, 0 deletions
diff --git a/progs/fpglsl/tex-multi.glsl b/progs/fpglsl/tex-multi.glsl
new file mode 100644
index 0000000000..5220b7efaf
--- /dev/null
+++ b/progs/fpglsl/tex-multi.glsl
@@ -0,0 +1,15 @@
+// Multi-texture fragment shader
+// Brian Paul
+
+// Composite second texture over first.
+// We're assuming the 2nd texture has a meaningful alpha channel.
+
+uniform sampler2D tex1;
+uniform sampler2D tex2;
+
+void main()
+{
+ vec4 t1 = texture2D(tex1, gl_Color.xy);
+ vec4 t2 = texture2D(tex2, gl_Color.yz);
+ gl_FragColor = mix(t1, t2, t2.w);
+}