summaryrefslogtreecommitdiff
path: root/shaders/tesseract/9.shader_test
diff options
context:
space:
mode:
Diffstat (limited to 'shaders/tesseract/9.shader_test')
-rw-r--r--shaders/tesseract/9.shader_test40
1 files changed, 40 insertions, 0 deletions
diff --git a/shaders/tesseract/9.shader_test b/shaders/tesseract/9.shader_test
new file mode 100644
index 0000000..3587b63
--- /dev/null
+++ b/shaders/tesseract/9.shader_test
@@ -0,0 +1,40 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+#version 120
+#extension GL_ARB_texture_rectangle : enable
+#define flat
+#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset))
+#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset))
+attribute vec4 vvertex, vcolor;
+attribute vec2 vtexcoord0;
+uniform mat4 hudmatrix;
+varying vec2 texcoord0;
+varying vec4 colorscale;
+void main(void) {
+ gl_Position = hudmatrix * vvertex;
+ texcoord0 = vtexcoord0;
+ colorscale = vcolor;
+}
+
+[fragment shader]
+#version 120
+#extension GL_ARB_texture_rectangle : enable
+#define flat
+#define texture2DRectOffset(sampler, coords, offset) texture2DRect(sampler, coords + vec2(offset))
+#define shadow2DRectOffset(sampler, coords, offset) shadow2DRect(sampler, coords + vec2(offset))
+#define fragdata(loc, name, type)
+#define fragcolor gl_FragData[0]
+uniform sampler2D tex0;
+uniform vec4 textparams;
+varying vec2 texcoord0;
+varying vec4 colorscale;
+fragdata(0, fragcolor, vec4)
+void main(void) {
+ float dist = texture2D(tex0, texcoord0).r;
+ float border = smoothstep(textparams.x, textparams.y, dist);
+ float outline = smoothstep(textparams.z, textparams.w, dist);
+ fragcolor = vec4(colorscale.rgb * outline, colorscale.a * border);
+}
+