+
+ #define MAKE_SHADER(A)#A
+
+ const char* VERTEX_SHADER = MAKE_SHADER(
+ attribute mediump vec2 aPosition;
+ attribute mediump vec2 aTexCoord;
+ uniform mediump mat4 uMvpMatrix;
+ uniform mediump vec3 uSize;
+ varying mediump vec2 vTexCoord;
+
+ void main()
+ {
+ mediump vec4 position = vec4( aPosition, 0.0, 1.0 );
+ position.xyz *= uSize;
+ gl_Position = uMvpMatrix * position;
+ vTexCoord = aTexCoord;
+ }
+ );
+
+ const char* FRAGMENT_SHADER_L8 = MAKE_SHADER(
+ uniform lowp vec4 uColor;
+ uniform sampler2D sTexture;
+ varying mediump vec2 vTexCoord;
+
+ void main()
+ {
+ mediump vec4 color = texture2D( sTexture, vTexCoord );
+ gl_FragColor = vec4( uColor.rgb, uColor.a * color.r );
+ }
+ );
+
+ const char* FRAGMENT_SHADER_RGBA = MAKE_SHADER(
+ uniform sampler2D sTexture;
+ varying mediump vec2 vTexCoord;
+
+ void main()
+ {
+ gl_FragColor = texture2D( sTexture, vTexCoord );
+ }
+ );
+