Page 4 of 5

Re: LÖVE 0.6.1

Posted: Wed Mar 03, 2010 3:44 am
by Jasoco
Question. I heard mention of nearest neighbor scaling in 0.6.x, but cannot get it to work how I thought it would. I had thought image:setFilter(1,1) would allow me to scale an image without antialiasing. i.e. each pixel would scale up roughly and solidly. For instance:

Image

The left would be enormously useful to me. The right is what I get when I try. Does it not exist in Löve? Was I mistaken?

Re: LÖVE 0.6.1

Posted: Wed Mar 03, 2010 4:50 am
by thelinx
What isn't working for you? According to the wiki, image:setFilter is the way to go.

Re: LÖVE 0.6.1

Posted: Wed Mar 03, 2010 5:07 am
by Jasoco
Hmm. It works when I use draw, but not when I use quads. Does it not work with quads?

If I do draw then it works. But if I do drawq it uses the default antialised mode. Also, I can't use it with fonts, can I? I wish there was a way to set it globally instead of every image individually.

Re: LÖVE 0.6.1

Posted: Wed Mar 03, 2010 6:13 am
by thelinx
Jasoco wrote:I wish there was a way to set it globally instead of every image individually.

Code: Select all

do
    local nuimg = love.graphics.newImage
    function love.graphics.newImage(...)
        local i = nuimg(...)
        i:setFilter(1,1)
        return i
    end
end

Re: LÖVE 0.6.1

Posted: Wed Mar 03, 2010 6:17 am
by Jasoco
But does it work on Quads and imageFonts?

Re: LÖVE 0.6.1

Posted: Wed Mar 03, 2010 6:37 am
by thelinx
Jasoco wrote:But does it work on Quads and imageFonts?
I guess not.

Re: LÖVE 0.6.1

Posted: Wed Mar 03, 2010 2:52 pm
by TechnoCat
Should work just fine with quads.

Re: LÖVE 0.6.1

Posted: Thu Mar 04, 2010 1:57 am
by Jasoco
Looks like it does. I'll examine the code and see where I was going wrong.

Thanks

Re: LÖVE 0.6.1

Posted: Thu Mar 04, 2010 5:12 am
by Jasoco
Heh. Well this is interesting. Rude, you'll want to look at this.

In my other thread, the one asking for help converting my game to 0.6.1 rude gave me an updated version of 0.6.1 that fixed the rectangles and font clipping. (I'll call it 0.6.1b) But before I downloaded that, Technocat gave me the above "quad.love" file. Which worked in 0.6.1. But now I try loading it in the new updated 0.6.1 and it crashes (Blue screen) when I try to switch to nearest neighbor. But it works fine in the release 0.6.1.

main.lua:92: Invalid filter mode: 1
[C] In function 'setFilter'

That's what I get when loading "quad.love" with 0.1.6b and press c to change modes. But it works fine in 0.6.1. I guess something changed.

Re: LÖVE 0.6.1

Posted: Thu Mar 04, 2010 5:15 am
by TechnoCat
Jasoco wrote: main.lua:92: Invalid filter mode: 1
[C] In function 'setFilter'
0.6.2 uses string constants for setFilter now. They are now "nearest" and "linear".
http://love.hg.sourceforge.net/hgweb/lo ... ges.txt#l8
http://love.hg.sourceforge.net/hgweb/lo ... ge.cpp#l53