2017-06-23 15:38:45 +00:00
|
|
|
#include "render/gles2.h"
|
|
|
|
#include <GLES2/gl2.h>
|
2017-06-08 19:52:42 +00:00
|
|
|
|
2017-06-15 19:31:13 +00:00
|
|
|
// Colored quads
|
|
|
|
const GLchar quad_vertex_src[] =
|
|
|
|
"uniform mat4 proj;"
|
|
|
|
"uniform vec4 color;"
|
|
|
|
"attribute vec2 pos;"
|
|
|
|
"attribute vec2 texcoord;"
|
|
|
|
"varying vec4 v_color;"
|
|
|
|
"varying vec2 v_texcoord;"
|
|
|
|
"void main() {"
|
|
|
|
" gl_Position = proj * vec4(pos, 0.0, 1.0);"
|
|
|
|
" v_color = color;"
|
|
|
|
" v_texcoord = texcoord;"
|
|
|
|
"}";
|
|
|
|
|
|
|
|
const GLchar quad_fragment_src[] =
|
|
|
|
"precision mediump float;"
|
|
|
|
"varying vec4 v_color;"
|
|
|
|
"varying vec2 v_texcoord;"
|
|
|
|
"void main() {"
|
|
|
|
" gl_FragColor = v_color;"
|
|
|
|
"}";
|
|
|
|
|
|
|
|
// Colored ellipses (TODO)
|
|
|
|
|
|
|
|
const GLchar ellipse_fragment_src[] =
|
|
|
|
"precision mediump float;"
|
|
|
|
"varying vec4 v_color;"
|
|
|
|
"varying vec2 v_texcoord;"
|
|
|
|
"void main() {"
|
|
|
|
" float l = length(v_texcoord - vec2(0.5, 0.5));"
|
|
|
|
" if (l > 0.5) discard;"
|
|
|
|
" gl_FragColor = v_color;"
|
|
|
|
"}";
|
|
|
|
|
|
|
|
// Textured quads
|
2017-06-08 19:52:42 +00:00
|
|
|
const GLchar vertex_src[] =
|
2017-06-15 19:31:13 +00:00
|
|
|
"uniform mat4 proj;"
|
|
|
|
"attribute vec2 pos;"
|
|
|
|
"attribute vec2 texcoord;"
|
|
|
|
"varying vec2 v_texcoord;"
|
|
|
|
"void main() {"
|
|
|
|
" gl_Position = proj * vec4(pos, 0.0, 1.0);"
|
|
|
|
" v_texcoord = texcoord;"
|
|
|
|
"}";
|
2017-06-08 19:52:42 +00:00
|
|
|
|
|
|
|
const GLchar fragment_src_RGB[] =
|
2017-06-15 19:31:13 +00:00
|
|
|
"precision mediump float;"
|
|
|
|
"varying vec2 v_texcoord;"
|
|
|
|
"uniform sampler2D tex;"
|
|
|
|
"void main() {"
|
|
|
|
" gl_FragColor = vec4(texture2D(tex, v_texcoord).rgb, 1.0);"
|
|
|
|
"}";
|
2017-06-08 19:52:42 +00:00
|
|
|
|
|
|
|
const GLchar fragment_src_RGBA[] =
|
2017-06-15 19:31:13 +00:00
|
|
|
"precision mediump float;"
|
|
|
|
"varying vec2 v_texcoord;"
|
|
|
|
"uniform sampler2D tex;"
|
|
|
|
"void main() {"
|
|
|
|
" gl_FragColor = texture2D(tex, v_texcoord);"
|
|
|
|
"}";
|