I am trying to implement layer function like photoshop. Here is what I want to draw..
But It is drawn like below
It is using two layers. made with 2 texture framebuffers one for background, the other one for drawing. textures are mix with fragment shader.
mediump vec4 tex0_color = texture2D(texunit0,TexCoordOut); // bg texture
mediump vec4 tex1_color = texture2D(texunit1,TexCoordOut); // drawing texture
mediump vec4 mix_color = mix(tex0_color,tex1_color,tex1_color.a);
and each draw on drawing layer is performed with vertex point sprite
highp float a = DestinationColor.a * texture2D(texunit0,gl_PointCoord).a;
gl_FragColor = vec4(DestinationColor.rgb,a);
and blend functions setted like below..
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Could you give me some advice?