简体   繁体   中英

In iOS openGL, how can one create a blend mode similar to kCGBlendModeDarken?

On a white background, drawing lines using kCGBlendModeDarken darkens the areas where different colors meet, like this:

混合模式变暗

I am trying to recreate this using openGL in iOS, but I don't know how to set the glBlendFunc properties to achieve this. The openGL documentation is hard to grasp for a beginner.

What would be the proper way to achieve this in openGL ES 1_X on iOS?

Assuming that kCGBlendModeDarken is just a regular darkening blend mode, the same effect can be achieved in OpenGL using these two commands:

glBlendFunc(GL_ONE, GL_ONE);
glBlendEquation(GL_MIN);

Depending on your version of OpenGL, GL_MIN might be GL_FUNC_MIN .

I am using glBlendEquationOES(GL_MIN_EXT); .

glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM