0.9.2 to 11.2 drawing quads with alpha
Posted: Mon Jan 14, 2019 9:18 am
In 0.9.2 in-stencil cloud quads drawn over terrain quads rendered intuitively, as one would expect in a graphics program via layers. Occasionally clouds overlapped so the effect was more opaque (heavy clouds), which effect was exploited to simulate a storm cloud by intermittently drawing another quad over it consisting of the same cloud with a ray of lightning.
In 11.2 the cloud renders totally different, some unknown blending changes its colors or the pixel colors under the transparent pixels. I’ve never used [read: understood] canvas, layer or blend commands in Löve though I’ve tried various of the latter with no success. I get either a white or magenta effect. How do I get the intuitive effect back in 11.2?
In 11.2 the cloud renders totally different, some unknown blending changes its colors or the pixel colors under the transparent pixels. I’ve never used [read: understood] canvas, layer or blend commands in Löve though I’ve tried various of the latter with no success. I get either a white or magenta effect. How do I get the intuitive effect back in 11.2?
Code: Select all
love.graphics.stencil( scope_stencil, “replace", 1, false )
love.graphics.setStencilTest( "greater", 0 )
LGD( maskScreen, 24*s, 20*s, 0, s, s ) -- love.graphics.draw full tile set unpopulated
do
if #cits.grid > 0 then
for i=1, #cits.grid do
x, y = cits.grid[i][1], cits.grid[i][2]
h = ter.hgt[x][y]
LGD( thimage, img_terr[6], pX[x], pY[y], 0, s, s )
LGD( dalerts, digitsTerr[h], pX[x]+1, pY[y]+1, 0, s, s )
end
end
-- DRAW CLOUDS
love.graphics.setBlendMode(“add”, “alphamultiply”) -- one of many clumsy attempts
if #clouds.grid > 0 then
setCol[“clouds”]() -- love.graphics.setColor rgba where alpha=89/255
for i=1, #clouds.grid do
local x, y = clouds.grid[i][1], clouds.grid[i][2]
LGD( thimage, img_clds[1], pX[x], pY[y], 0, s, s )
end
if #storm.grid > 0 then
for i=1, #storm.grid do
local x, y = storm.grid[i][1], storm.grid[i][2]
if lightning == 0 then
LGD( thimage, img_clds[1], pX[x], pY[y], 0, s, s )
else
LGD( thimage, img_clds[2], pX[x], pY[y], 0, s, s )
end
end
end
end
love.graphics.setBlendMode("alpha")
setCol["draw"]()
love.graphics.setStencilTest()