Merge branch 'master' into matrix-redesign

This commit is contained in:
emersion 2018-03-15 15:48:09 +01:00
commit 8b58e1a3ad
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
16 changed files with 809 additions and 8 deletions

View file

@ -32,6 +32,7 @@ const GLchar quad_fragment_src[] =
"precision mediump float;"
"varying vec4 v_color;"
"varying vec2 v_texcoord;"
""
"void main() {"
" gl_FragColor = v_color;"
"}";
@ -41,6 +42,7 @@ 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;"
@ -50,6 +52,7 @@ const GLchar ellipse_fragment_src[] =
// Textured quads
const GLchar vertex_src[] =
"uniform mat3 proj;"
"uniform bool invert_y;"
"attribute vec2 pos;"
"attribute vec2 texcoord;"
"varying vec2 v_texcoord;"
@ -67,8 +70,12 @@ const GLchar vertex_src[] =
"}"
""
"void main() {"
" gl_Position = vec4(transpose(proj) * vec3(pos, 1.0), 1.0);"
" v_texcoord = texcoord;"
" gl_Position = vec4(transpose(proj) * vec3(pos, 1.0), 1.0);"
" if (invert_y) {"
" v_texcoord = vec2(texcoord.s, 1.0 - texcoord.t);"
" } else {"
" v_texcoord = texcoord;"
" }"
"}";
const GLchar fragment_src_rgba[] =
@ -76,6 +83,7 @@ const GLchar fragment_src_rgba[] =
"varying vec2 v_texcoord;"
"uniform sampler2D tex;"
"uniform float alpha;"
""
"void main() {"
" gl_FragColor = alpha * texture2D(tex, v_texcoord);"
"}";
@ -85,6 +93,7 @@ const GLchar fragment_src_rgbx[] =
"varying vec2 v_texcoord;"
"uniform sampler2D tex;"
"uniform float alpha;"
""
"void main() {"
" gl_FragColor.rgb = alpha * texture2D(tex, v_texcoord).rgb;"
" gl_FragColor.a = alpha;"
@ -95,6 +104,7 @@ const GLchar fragment_src_external[] =
"precision mediump float;"
"varying vec2 v_texcoord;"
"uniform samplerExternalOES texture0;"
""
"void main() {"
" vec4 col = texture2D(texture0, v_texcoord);"
" gl_FragColor = vec4(col.rgb, col.a);"