summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-02-16 10:44:24 -0500
committerDavid Thompson <dthompson2@worcester.edu>2014-02-16 10:47:04 -0500
commitfc2584672c096ae63469cce9ede9abaa4a95ece7 (patch)
tree2de08e6fad5251720ff58abed145a8c83741c93d /data
parentfd04e2133e098359e439a087535ce287f7fcc639 (diff)
Rewrite font module.
FTGL has been dropped in favor of SDL_ttf. * 2d/font: Rewrite everything! * 2d/wrappers/ftgl.scm: Delete it. * configure.ac: Check for SDL_ttf. * data/Makefile.am (shaders_DATA): Add font shaders. * data/shaders/font-fragment.glsl: New shader. * data/shaders/font-vertex.glsl: New shader. * examples/font.scm: Rewrite font example. * examples/fonts/AUTHORS: Delete it. * examples/fonts/Boxy-Bold.ttf: Delete it.
Diffstat (limited to 'data')
-rw-r--r--data/Makefile.am4
-rw-r--r--data/shaders/font-fragment.glsl8
-rw-r--r--data/shaders/font-vertex.glsl15
3 files changed, 26 insertions, 1 deletions
diff --git a/data/Makefile.am b/data/Makefile.am
index b6d0d74..8fc3a3e 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -4,4 +4,6 @@ fonts_DATA = fonts/DejaVuSans.ttf
shadersdir = $(pkgdatadir)/shaders
shaders_DATA = \
shaders/sprite-vertex.glsl \
- shaders/sprite-fragment.glsl
+ shaders/sprite-fragment.glsl \
+ shaders/font-vertex.glsl \
+ shaders/font-fragment.glsl
diff --git a/data/shaders/font-fragment.glsl b/data/shaders/font-fragment.glsl
new file mode 100644
index 0000000..3dd10f1
--- /dev/null
+++ b/data/shaders/font-fragment.glsl
@@ -0,0 +1,8 @@
+#version 120
+
+uniform sampler2D color_texture;
+uniform vec4 color;
+
+void main (void) {
+ gl_FragColor = texture2D(color_texture, gl_TexCoord[0].st) * color;
+}
diff --git a/data/shaders/font-vertex.glsl b/data/shaders/font-vertex.glsl
new file mode 100644
index 0000000..196da12
--- /dev/null
+++ b/data/shaders/font-vertex.glsl
@@ -0,0 +1,15 @@
+#version 120
+
+uniform mat4 projection;
+uniform vec2 position;
+uniform vec2 anchor;
+
+void main(void) {
+ mat4 translation = mat4(1.0, 0.0, 0.0, position.x - anchor.x,
+ 0.0, 1.0, 0.0, position.y - anchor.y,
+ 0.0, 0.0, 1.0, 0.0,
+ 0.0, 0.0, 0.0, 1.0);
+
+ gl_Position = projection * (gl_Vertex * translation);
+ gl_TexCoord[0] = gl_MultiTexCoord0;
+}