OpenGL alignment

In the drawing application that I am developing, I want my user to be able to paint with a transparent brush, for example black paint on a white background should lead to gray. When more paint is applied, the resulting color will be closer to black.

enter image description here

However, no matter how many times I draw over a place, the resulting color is never black; in fact, it stops changing after a few lines. Photoshop says the alpha blob drawn on the left in OpenGL is max 0.8, where I expect it to be 1.

My application works by drawing a series of stamps, as in the Apple GLPaint example, to form a line. Stamps are mixed with the following function:

glBlendFuncSeparate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ONE_MINUS_DST_ALPHA, GL_ONE);
glBlendEquation(GL_FUNC_ADD);

My fragment shader:

uniform lowp sampler2D u_texture;
varying highp vec4 f_color;

void main(){
    gl_FragColor = texture2D(u_texture, gl_PointCoord).aaaa*f_color*vec4(f_color.aaa, 1);
}

How to adjust blending to get full color when painting again?

Update 11/11/2013

, , , . :

    glGenFramebuffers(1, &textureFramebuffer);
    glBindFramebuffer(GL_FRAMEBUFFER, textureFramebuffer);

    glGenTextures(1, &drawingTexture);
    glBindTexture(GL_TEXTURE_2D, drawingTexture);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,  pixelWidth, pixelHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);

02/12/2013 Apple GLPaint, , iOS7. , iOS 7 .

GL_ONE, GL_ONE_MINUS_SRC_ALPHA

blend iOS6. iOS7 CALAyer - ?

iOS6iOS7

10/07/2014

Apple GLPaint iOS7, . , : Apple GLPaint Apple iOS7

+4
1

, "" , . , . (GL_ONE, GL_ONE_MINUS_SRC_ALPHA) (). - , , glColor .

- .

+1

All Articles