23 #ifndef PAINTEROGL2_SHADERSOURCES_H
24 #define PAINTEROGL2_SHADERSOURCES_H
26 static const std::string glslMainVertexShader =
"\n\
27 highp vec4 calculatePosition();\n\
29 gl_Position = calculatePosition();\n\
32 static const std::string glslMainWithTexCoordsVertexShader =
"\n\
33 attribute highp vec2 a_TexCoord;\n\
34 uniform highp mat3 u_TextureMatrix;\n\
35 varying highp vec2 v_TexCoord;\n\
36 highp vec4 calculatePosition();\n\
39 gl_Position = calculatePosition();\n\
40 v_TexCoord = (u_TextureMatrix * vec3(a_TexCoord,1.0)).xy;\n\
43 static std::string glslPositionOnlyVertexShader =
"\n\
44 attribute highp vec2 a_Vertex;\n\
45 uniform highp mat3 u_TransformMatrix;\n\
46 uniform highp mat3 u_ProjectionMatrix;\n\
47 highp vec4 calculatePosition() {\n\
48 return vec4(u_ProjectionMatrix * u_TransformMatrix * vec3(a_Vertex.xy, 1.0), 1.0);\n\
51 static const std::string glslMainFragmentShader =
"\n\
52 uniform lowp float u_Opacity;\n\
53 lowp vec4 calculatePixel();\n\
56 gl_FragColor = calculatePixel();\n\
57 gl_FragColor.a *= u_Opacity;\n\
60 static const std::string glslTextureSrcFragmentShader =
"\n\
61 varying mediump vec2 v_TexCoord;\n\
62 uniform lowp vec4 u_Color;\n\
63 uniform sampler2D u_Tex0;\n\
64 lowp vec4 calculatePixel() {\n\
65 return texture2D(u_Tex0, v_TexCoord) * u_Color;\n\
68 static const std::string glslSolidColorFragmentShader =
"\n\
69 uniform lowp vec4 u_Color;\n\
70 lowp vec4 calculatePixel() {\n\