Page 1 of 1

[SOLVED] Canvas rendering issue in Android.

Posted: Tue Jan 09, 2024 5:26 pm
by alberto_lara
Hi there, so I'm working on a game and, while the canvas looks perfectly crisp (nearest filtered) in my PC, it doesn't look so in Android:
Image

This is how it should look:
Image

I made sure of:

* The canvas being low resolution (it's 320x180)
* The canvas having the right filter
* For testing, I even manually set the filter to the image itself (the sassy puzzle title) and the result is the same.

Maybe it's an issue related to OpenGL ES? Idk.

Thanks in advance.

Re: Canvas rendering issue in Android.

Posted: Tue Jan 09, 2024 6:49 pm
by marclurr
I had the same issue, it's to do with DPI scaling on mobile devices. Create your canvas like this:

Code: Select all

love.graphics.newCanvas(WIDTH, HEIGHT, { dpiscale = 1})

Re: Canvas rendering issue in Android.

Posted: Wed Jan 10, 2024 1:21 am
by alberto_lara
That did the trick, thanks!

As a note, I had to use the same in fonts for the 4th argument (they were still looking glitchy)

Code: Select all

font = love.graphics.newFont('assets/fonts/proggy-tiny/proggy-tiny.ttf', 16, 'normal', 1)
debugFont = love.graphics.newFont('assets/fonts/proggy-tiny/proggy-tiny.ttf', 32, 'normal', 1)