Reputation: 321
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?
Upvotes: 0
Views: 2350
Reputation: 949
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glBlendEquationSeparate(GL_FUNC_ADD, GL_FUNC_ADD);
Upvotes: 0
Reputation: 14678
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
.
Upvotes: 1