开发者

OpenGLES mix and match blending options complicated question

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开发者_Python百科 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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜