summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-06-09 12:59:20 +0300
committerAndrei Karas <akaras@inbox.ru>2014-06-09 12:59:20 +0300
commit5fe5d3de3c570734d824afac4992a0d00386dbea (patch)
treea8a44914014951142d80c4529dcae64c513dc0f1
parent49aba83fa6f3393214919166c42fb55c5a9a7796 (diff)
downloadmv-5fe5d3de3c570734d824afac4992a0d00386dbea.tar.gz
mv-5fe5d3de3c570734d824afac4992a0d00386dbea.tar.bz2
mv-5fe5d3de3c570734d824afac4992a0d00386dbea.tar.xz
mv-5fe5d3de3c570734d824afac4992a0d00386dbea.zip
Add shaders for drawing textures.
-rw-r--r--data/graphics/shaders/CMakeLists.txt2
-rw-r--r--data/graphics/shaders/Makefile.am4
-rw-r--r--data/graphics/shaders/simple_vertex.glsl2
-rw-r--r--data/graphics/shaders/texture_frag.glsl8
-rw-r--r--data/graphics/shaders/texture_vertex.glsl10
5 files changed, 24 insertions, 2 deletions
diff --git a/data/graphics/shaders/CMakeLists.txt b/data/graphics/shaders/CMakeLists.txt
index 0dc6cc124..bc4c3e78f 100644
--- a/data/graphics/shaders/CMakeLists.txt
+++ b/data/graphics/shaders/CMakeLists.txt
@@ -1,6 +1,8 @@
SET(FILES
simple_frag.glsl
simple_vertex.glsl
+ texture_frag.glsl
+ texture_vertex.glsl
)
INSTALL(FILES ${FILES} DESTINATION ${DATA_DIR}/graphics/shaders)
diff --git a/data/graphics/shaders/Makefile.am b/data/graphics/shaders/Makefile.am
index db10da9b1..54aab1330 100644
--- a/data/graphics/shaders/Makefile.am
+++ b/data/graphics/shaders/Makefile.am
@@ -2,7 +2,9 @@ shadersdir = $(pkgdatadir)/data/graphics/shaders
shaders_DATA = \
simple_frag.glsl \
- simple_vertex.glsl
+ simple_vertex.glsl \
+ texture_frag.glsl \
+ texture_vertex.glsl
EXTRA_DIST = \
$(shaders_DATA) \
diff --git a/data/graphics/shaders/simple_vertex.glsl b/data/graphics/shaders/simple_vertex.glsl
index 766fd5fe5..1ffca8f77 100644
--- a/data/graphics/shaders/simple_vertex.glsl
+++ b/data/graphics/shaders/simple_vertex.glsl
@@ -3,5 +3,5 @@ in vec2 simplePos;
uniform vec2 screen;
void main()
{
- gl_Position = vec4(simplePos.x / screen.x - 1, 1 - simplePos.y / screen.y, 0.0, 1.0);
+ gl_Position = vec4(simplePos.x / screen.x - 1, 1 - simplePos.y / screen.y, 0.0, 1.0);
}
diff --git a/data/graphics/shaders/texture_frag.glsl b/data/graphics/shaders/texture_frag.glsl
new file mode 100644
index 000000000..7eac7771e
--- /dev/null
+++ b/data/graphics/shaders/texture_frag.glsl
@@ -0,0 +1,8 @@
+#version 150 core
+in vec2 Texcoord;
+out vec4 outColor;
+uniform sampler2D tex;
+void main()
+{
+ outColor = texture(tex, Texcoord);
+}
diff --git a/data/graphics/shaders/texture_vertex.glsl b/data/graphics/shaders/texture_vertex.glsl
new file mode 100644
index 000000000..e6c1bf359
--- /dev/null
+++ b/data/graphics/shaders/texture_vertex.glsl
@@ -0,0 +1,10 @@
+#version 150 core
+in vec2 simplePos;
+in vec2 texcoord;
+out vec2 Texcoord;
+uniform vec2 screen;
+void main()
+{
+ Texcoord = texcoord;
+ gl_Position = vec4(simplePos.x / screen.x - 1, 1 - simplePos.y / screen.y, 0.0, 1.0);
+}