I would like to know how not to have the alpha values that add up, here is an image of what I would like.
First the default situation, and second what I would like:
So I tried several ways but I can't find a way without having to use a canvas (i.e. draw in a canvas then apply the alpha to the canvas display).
I for example use blendmodes but it's never what I expect, for example with lg.setBlendMode("replace") I got this:
We can see that the alpha has not been added but there is no more transparency, so maybe I'm doing it wrong.
Here is my code for the last example image:
Code: Select all
local win_w, win_h = love.graphics.getDimensions()
local x1, y = win_w/2, win_h/2
local x2, x3 = x1-100, x1+100
function love.draw()
love.graphics.setColor(.5,.5,.5,1)
love.graphics.rectangle("fill", 0,0,x1,win_h)
love.graphics.setBlendMode("replace")
love.graphics.setColor(1,1,0, .5)
love.graphics.circle("fill", x1, y, 100)
love.graphics.circle("fill", x2, y, 100)
love.graphics.circle("fill", x3, y, 100)
love.graphics.setBlendMode("alpha")
end