We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3594

Summary: Bitwise blending mode
Product: SDL Reporter: Vitaly Novichkov <admin>
Component: renderAssignee: Sam Lantinga <slouken>
Status: RESOLVED WONTFIX QA Contact: Sam Lantinga <slouken>
Severity: enhancement    
Priority: P2    
Version: HG 2.1   
Hardware: All   
OS: All   

Description Vitaly Novichkov 2017-03-01 08:44:22 UTC
I wasn't found the way to have bitwise "or" and bitwise "and" blending mode,
I.e. as

"buffer.rgb |= img.rgb" and "buffer.rgb &= img.rgb"

I want to use this mode for some graphical effects are impossible with alpha-blending, like the mountain has the invisible tunnel which can be shown when a special light filter will be drawn over the mountain.
Comment 1 Sam Lantinga 2017-08-11 17:47:37 UTC
Feel free to submit a patch for the various rendering implementations, including the software renderer.
Comment 2 Sam Lantinga 2017-08-14 07:12:17 UTC
As far as I can tell these blending modes are impossible without a custom pixel shader, which is outside the scope of the SDL renderer.
Comment 3 Vitaly Novichkov 2017-08-14 08:11:58 UTC
My thinks:
- In case of software renderer that must be easy
- In case of OpenGL I guess, some extensions are needed (the example where are various render modes shown: https://github.com/WohlSoft/LunaLua/blob/ee86b73c1976051d3ad18f259e36724310de2124/LunaDll/Rendering/GL/GLDraw.cpp#L54-L90, it uses GLEW library which is used to manage extensions)
- In case of OpenGL ES would be similar as with desktop OpenGL.
- In case of Direct X - IDK, I never used DX by myself. Did you actually meant Direct X?