Ok so, I've got a little problem with scaling. I'm not sure whether this is due to the algorithm Love/SDL uses to scale objects or if it's something on my end.
Basically I have this wire that I stretch. In the game, the longer I stretch it, the more I see the ends being transparent.
Here's how it looks in the engine:
Here's how it should look:
Any idea how Love handles scaling or why this happens?
Well, that's a bit odd. You can test if it's the linear filter and set it to nearest neighbor: Image:setFilter("nearest", "nearest"). If that "fixes" it, then it might be the neighboring pixel bleeding in... but that doesn't make sense if it's a 50x1, unless you have OpenGL 1.x without the non-power-of-two extension. In that case, it would pad the image to 64x2, however, that should look different than what you showed us. Edit: This is probably not correct.
I'm not sure... Can you produce a small test case that shows the same behaviour?
Are you drawing something semi-transparent somewhere else?
I'm asking because you could have left a love.graphics.setColor(255,255,255,100) somewhere. Try setting the color to 255,255,255 right before drawing the image.
If that doesn't do it, upload the image you are using to the forum, so others can try it out.
Hey, I'm the artist on this project and jsut wanted to point out (Omar forgot to mention)
The 50x1 pixels cable asset is part of a spritesheet , and it's surrounded by transparent pixels
That's another reason why bicubic\bipolar scaling might be a factor.
xelu wrote:The 50x1 pixels cable asset is part of a spritesheet , and it's surrounded by transparent pixels
That's another reason why bicubic\bipolar scaling might be a factor.
Oh yeah, that's it. Pad the border with the color of neighboring pixel instead of transparent ones. That means that you'll need 2 pixel between the sprites on the sheet, but it will ensure that it interpolates the colors as expected.
The thing was, i tried to surround it with same color pixels before manually.. and that fixed the problem but i didn't wanted to do this manually since I'm using this -http://www.codeandweb.com/texturepacker - Texture Packer to create the sprite sheets.
That would mean doing that procedure every time i make a change to the sprites.... So I thought this could be solved by code
But after taking a closer look I noticed the "Extrude" option in that program , that does exactly that... So this is a better way to solve this after all instead of trying to do the Nearest Neighbor thing code wise...