LuaIsLife wrote: ↑Sun Nov 04, 2018 1:43 pm
.. holy... Yes, that did it.... Care to explain why the old code did work for all my "sprites" (images) but not for the stuff like circles/rectangles but the one with the "* color" part does?
Sure. Don't confuse the texture texel colour with the tinting colour set by calling
love.graphics.setColor.
love.graphics.setColor is used to tint whatever you draw. This tinting is done through component-wise multiplication of the texel colour and the setColor colour, and is performed in the shader. That colour is received in the 'color' parameter of the
effect() function. According to the wiki, there is always a shader active, even if you don't define one. Take a look at the default LÖVE shader in
love.graphics.newShader#Notes_2. Note how it multiplies by 'color' so that it can tint what you draw!
The texture in the default primitives (circle, rectangle, line...) is a 1x1 white pixel (I'm not 100% sure if that's the case, but you can certainly think of it this way). That means that its colour is R=1, G=1, B=1, A=1. Those values, multiplied by the setColor value, give you the setColor value unchanged, therefore all those primitives are drawn with that colour. So, when you draw a coloured primitive, what you're actually doing is tinting its white texture. And for that to work, the shader must support tinting.
The texture in your images is the image itself. If you don't multiply the texture colour by the 'color' parameter, you can't tint your images using love.graphics.setColor. I doubt you're using setColor for tinting your images (other than to set it to 1,1,1,1), that's why when drawing your images, you don't see a difference between the version that multiplies by 'color' and the version that doesn't.
Apologies if the explanation isn't too clear. I find it somewhat hard to explain.