views:

38

answers:

1

So I have a background line drawing, black and white. I want to be able to draw over this, keeping the black lines in there, and drawing only where it is white. I can do this by using

glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA);

And the black stays black and white gets whatever color I want. However in the white areas, I want to be able to draw some color, pick to another color and then blend. However this doesn't work because the blend function is messed up.

So what I was thinking is having a linedrawing framebuffer, and a user-drawing framebuffer. The user draws into the userdrawing framebuffer, with a different blending, and then I switch blending options and draw into the linedrawing framebuffer. But i don't know enough OpenGL to say whether or not this will work or is a stupid idea.

Thanks a lot

A: 

If your drawing is transparent in the white regions, you can do this: Draw your colored areas first and then the line drawing over them, using the standard GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA blend.

codewarrior
I thought about this, but first it isn't transparent in the white regions, it is white, although I could edit it. The more important thing is that I am not flushing the frame buffer in order to save CPUs...
DevDevDev