love-blendmode --------------- Bugs fixed: saveState() and getBlendMode() only supported "alpha" and "additive" modes. setBackgroundColor() did not use the alpha parameter. Cleanups: opengl/Graphics.cpp now makes use of its own get* functions in saveState, instead of making duplicated OpenGL calls and related logic. New functionality: There are three major ways to use the blend mode API depending on the amount of flexibility needed. 1) Simple modes The old/regular Löve modes. Implemented in scripts/graphics.lua. setBlendMode(simplemode) getBlendMode() returns simplemode getBlendModeRGB() returns src, dst, op -- the actual settings, getBlendModeAlpha() returns src, dst, op -- same for both 2) Common RGBA src,dst[,op] mode Sets the same mode for RGB and A. Implemented in scripts/graphics.lua. setBlendMode(src, dst) -- assumed "add" setBlendMode(src, dst, op) getBlendMode() == src, dst, op -- or maybe nil here? getBlendModeRGB() == src, dst, op getBlendModeAlpha() == src, dst, op 3) Separate RGB and A src,dst[,op] modes The full OpenGL 1.4 separate blend func/equation. Implemented in C++. setBlendModeRGB(srcRGB, dstRGB) -- assumed "add" setBlendModeRGB(srcRGB, dstRGB, opRGB) setBlendModeAlpha(srcA, dstA) -- assumed "add" setBlendModeAlpha(srcA, dstA, opA) getBlendMode() == nil -- N/A getBlendModeRGB() == srcRGB, dstRGB, opRGB getBlendModeAlpha() == srcA, dstA, opA Implemented: simplemode: alpha, additive, multiplicative, subtractive op operator: add, subtract, reverse_subtract, min, max (complete) src, dst factors: one, zero, src_alpha, one_minus_src_alpha, src_color, one_minus_src_color, dst_alpha, one_minus_dst_alpha, dst_color, one_minus_dst_color TO-DO: Constant color factors etc. Also, not all factors may be valid for RGB/A in src/dst etc. This IS defined by the OpenGL spec, but if we want validation in Löve we need to decide on a version to target. Note: I changed the terminology from OpenGL because I think this makes more sense. "src,dst factors" = blendfunc parameters "op" = blend equation. "mode" = the combination of src,dst,op or simplemode.