Premultiplied alpha

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
veethree
Inner party member
Posts: 787
Joined: Sat Dec 10, 2011 7:18 pm

Premultiplied alpha

Post by veethree » Thu May 17, 2018 7:43 am

I'm trying to draw a canvas with the "multiply" blend mode but it throws an error.

Code: Select all

Error

data/class/light.lua:41: The 'multiply' blend mode must be used with premultiplied alpha.


Traceback

[C]: in function 'setBlendMode'
data/class/light.lua:41: in function 'draw'
data/state/game.lua:131: in function 'draw'
data/class/state.lua:41: in function 'draw'
main.lua:163: in function 'draw'
[C]: in function 'xpcall'
I don't get it.

grump
Party member
Posts: 388
Joined: Sat Jul 22, 2017 7:43 pm

Re: Premultiplied alpha

Post by grump » Thu May 17, 2018 8:15 am

Code: Select all

love.graphics.setBlendMode('multiply', 'premultiplied')
It's a questionable design choice, but this is how you have to set the multiply blendmode.

User avatar
veethree
Inner party member
Posts: 787
Joined: Sat Dec 10, 2011 7:18 pm

Re: Premultiplied alpha

Post by veethree » Thu May 17, 2018 8:29 am

Oh. I didn't realise that setBlendMode had a 2nd argument. You'd think if you need premultiplied alpha to use the multiply blend mode it would default to that.
Or the error would indicate that it needs a 2nd argument.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 8 guests