diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-12-10 02:44:09 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-12-10 02:44:09 +0300 |
commit | 54d0234c8334bcd61ffb655a57e6147fd279b9e1 (patch) | |
tree | fa04d6f007f1facd844840a3bd2301d7e284500e | |
parent | d4106529d69071664d6532c70a21c70da134681c (diff) | |
download | manaplus-54d0234c8334bcd61ffb655a57e6147fd279b9e1.tar.gz manaplus-54d0234c8334bcd61ffb655a57e6147fd279b9e1.tar.bz2 manaplus-54d0234c8334bcd61ffb655a57e6147fd279b9e1.tar.xz manaplus-54d0234c8334bcd61ffb655a57e6147fd279b9e1.zip |
Add OpenGL ES 2 shaders.
-rw-r--r-- | data/graphics/shaders/CMakeLists.txt | 2 | ||||
-rw-r--r-- | data/graphics/shaders/Makefile.am | 2 | ||||
-rw-r--r-- | data/graphics/shaders/gles2_frag.glsl | 20 | ||||
-rw-r--r-- | data/graphics/shaders/gles2_vertex.glsl | 12 |
4 files changed, 36 insertions, 0 deletions
diff --git a/data/graphics/shaders/CMakeLists.txt b/data/graphics/shaders/CMakeLists.txt index 0dc6cc124..1ae389d50 100644 --- a/data/graphics/shaders/CMakeLists.txt +++ b/data/graphics/shaders/CMakeLists.txt @@ -1,4 +1,6 @@ SET(FILES + gles2_frag.glsl + gles2_vertex.glsl simple_frag.glsl simple_vertex.glsl ) diff --git a/data/graphics/shaders/Makefile.am b/data/graphics/shaders/Makefile.am index db10da9b1..543c8677b 100644 --- a/data/graphics/shaders/Makefile.am +++ b/data/graphics/shaders/Makefile.am @@ -1,6 +1,8 @@ shadersdir = $(pkgdatadir)/data/graphics/shaders shaders_DATA = \ + gles2_frag.glsl \ + gles2_vertex.glsl \ simple_frag.glsl \ simple_vertex.glsl diff --git a/data/graphics/shaders/gles2_frag.glsl b/data/graphics/shaders/gles2_frag.glsl new file mode 100644 index 000000000..ab642fcf6 --- /dev/null +++ b/data/graphics/shaders/gles2_frag.glsl @@ -0,0 +1,20 @@ +#version 100 +precision mediump float; + +uniform sampler2D tex; +uniform vec4 color; +uniform float drawType; +uniform float alpha; +varying mediump vec2 Texcoord; + +void main() +{ + if (drawType >= 0.1) + { + gl_FragColor = texture2D(tex, Texcoord) * vec4(1.0, 1.0, 1.0, alpha); + } + else + { + gl_FragColor = color; + } +} diff --git a/data/graphics/shaders/gles2_vertex.glsl b/data/graphics/shaders/gles2_vertex.glsl new file mode 100644 index 000000000..83bd7f42d --- /dev/null +++ b/data/graphics/shaders/gles2_vertex.glsl @@ -0,0 +1,12 @@ +#version 100 + +attribute vec4 position; +varying vec2 Texcoord; +uniform vec2 screen; +uniform vec2 textureSize; + +void main() +{ + Texcoord = vec2(position.z / textureSize.x, position.w / textureSize.y); + gl_Position = vec4(position.x / screen.x - 1.0, 1.0 - position.y / screen.y, 0.0, 1.0); +} |