diff options
author | emersion <contact@emersion.fr> | 2018-03-15 15:48:09 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-03-15 15:48:09 +0100 |
commit | 8b58e1a3ad45f3e791a15b070d5544f3fc4e6a7e (patch) | |
tree | b97fdf2deb525a5bc919bac3e410a905b0ef4821 /render/gles2/shaders.c | |
parent | 824a95ad19062e867178593f0937d14049422989 (diff) | |
parent | de0e40d621c51cf075825633946a9ac7f98ac213 (diff) |
Merge branch 'master' into matrix-redesign
Diffstat (limited to 'render/gles2/shaders.c')
-rw-r--r-- | render/gles2/shaders.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/render/gles2/shaders.c b/render/gles2/shaders.c index 9d3a67c2..a64b941e 100644 --- a/render/gles2/shaders.c +++ b/render/gles2/shaders.c @@ -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);" |