Hello.
I found interesting example in Cpp-Tests/ShaderTests, especially Effect and EffectSprite classes. Their API looks like EffectSprite can apply multiple Effects (whose are based on shaders), depending on effects priorities.
First shader (applyed first):
#ifdef GL_ES
precision highp float;
#endif
varying vec2 v_texCoord;
varying vec2 v_fragmentColor;
uniform vec3 u_lightColor;
uniform float u_lightBrightness;
void main(void)
{
vec4 texColor = texture2D(CC_Texture0, v_texCoord);
vec3 diffuse = u_lightBrightness * u_lightColor;
gl_FragColor = vec4(texColor.rgb * diffuse, texColor.a);
}
Second shader:
#ifdef GL_ES
precision highp float;
#endif
varying vec2 v_texCoord;
void main(void)
{
vec4 texColor = texture2D(CC_Texture0, v_texCoord);
gl_FragColor = gl_FragColor; // doesnt work
gl_FragColor = texColor; // resets the previously done work by first shader
}
My question is: how to access the texture rendered by first effect and pass it to the second one? texture2D(CC_Texture0, v_texCoord) doesnt look like a solution anyway.