From 0529df9a8021d09f592e0a6eef0c19e148c5336e Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 9 Feb 2014 15:09:18 -0500 Subject: Add shader module. * 2d/shader.scm: New module. * Makefile.am: Add 2d/shader.scm to SOURCES. * examples/shader.scm: New example. * examples/shaders/fragment-shader.glsl: New shader. * examples/shaders/vertex-shader.glsl: New shader. --- examples/shaders/fragment-shader.glsl | 7 +++++++ examples/shaders/vertex-shader.glsl | 13 +++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 examples/shaders/fragment-shader.glsl create mode 100644 examples/shaders/vertex-shader.glsl (limited to 'examples/shaders') diff --git a/examples/shaders/fragment-shader.glsl b/examples/shaders/fragment-shader.glsl new file mode 100644 index 0000000..9be52f0 --- /dev/null +++ b/examples/shaders/fragment-shader.glsl @@ -0,0 +1,7 @@ +#version 120 + +uniform sampler2D color_texture; + +void main (void) { + gl_FragColor = texture2D(color_texture, gl_TexCoord[0].st); +} diff --git a/examples/shaders/vertex-shader.glsl b/examples/shaders/vertex-shader.glsl new file mode 100644 index 0000000..2a7a4a4 --- /dev/null +++ b/examples/shaders/vertex-shader.glsl @@ -0,0 +1,13 @@ +#version 120 + +uniform float angle; + +void main(void) { + mat4 RotationMatrix = mat4(cos(angle), -sin(angle), 0.0, 0.0, + sin(angle), cos(angle), 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0); + + gl_Position = gl_ModelViewProjectionMatrix * RotationMatrix * gl_Vertex; + gl_TexCoord[0] = gl_MultiTexCoord0; +} -- cgit v1.2.3