0
votes

I'm trying to figure out if there is a way to control blending process during rendering.

For example: - there is a background texture, sprite1 and sprite 2 (all partly overlay). - sprite2 is white, background and sprite1 don't have white pixels - I want sprites to blend with the background, but not with each other.

Can I somehow program opengl to do the following for each pixel? - check if 3 colors are being blended and one of them is white, then blend just the other 2 and disregard white - if 2 colors are blended and one of them is white, then blend regularly

Is this something that can be done with shaders?

1
That's selective blending. You can do in shaders using custom frame buffers. Exactly how is quite complex to explain for OpenGL beginners. Begin with shaders and framebuffers first.you can find glsl blending equationa in the webMichael IV
Thank you for tour advice, Michael. I'm looking into frame buffers and shaders now and seem to get closer to my goal...Lez77

1 Answers

0
votes

http://www.clockworkcoders.com/oglsl/tutorial8.htm

multi-texturing will be used...

and for your second question you can use

if else for checking color

http://pastebin.com/WUGdER08