Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

We've been trying to replicate the most common blending modes that are available in Photoshop and Quartz 2D, but we've only come up with 3 and that's after some long searching online.

For anyone interested, here they are:

  • Multiply = GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA
  • Screen = GL_MINUS_DST_COLOR, GL_ONE
  • Linear Dodge = GL_ONE, GL_ONE

You can try these and other such modes in action online, at this very useful website: http://www.andersriggelsen.dk/glblendfunc.php

Now, we would appreciate it if anyone could provide us with additional blending modes that we can recreate inside Cocos2D, since our Open GL experience is really, really limited.

Thank you in advance!

Argiris

share|improve this question
    
Linear Dodge (Add) = GL_ONE, GL_ONE does this behave for you the same as at andersriggelsen.dk/glblendfunc.php and photoshop? it makes sprites transparent? not working for me –  rakkarage Feb 16 '12 at 16:56
add comment

1 Answer

Bad news is that you can't implement all of photoshop's blend modes with glBlendFunc, even though there are a bazillion of combinations that you can use.

Good news is, when you move to shaders, the orange book (OpenGL Shading Language, http://www.amazon.com/exec/obidos/ASIN/0321637631/khongrou-20 ) contains a chapter with shaders to emulate the photoshop's blend modes.

Luckily all you'll probably ever need in pre-shader world are the three most common blend modes;

  • Add: GL_ONE, GL_ONE
  • Blend: GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA
  • Multiply: various, such as the one you mentioned: GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA

EDIT:

Related (almost duplicate) question on stackoverflow: http://stackoverflow.com/questions/818230/photoshop-blending-mode-to-opengl-es-without-shaders

Photoshop blending shaders: http://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.