[SOLVED] Canvas rendering issue in Android.

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
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

[SOLVED] Canvas rendering issue in Android.

Post 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.
Last edited by alberto_lara on Wed Jan 10, 2024 1:40 am, edited 1 time in total.
User avatar
marclurr
Party member
Posts: 146
Joined: Fri Apr 22, 2022 9:25 am

Re: Canvas rendering issue in Android.

Post 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})
User avatar
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

Re: Canvas rendering issue in Android.

Post 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)
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests