Cam11 bug when zoom = 0.6 (specifically)

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
togFox
Party member
Posts: 779
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Cam11 bug when zoom = 0.6 (specifically)

Post by togFox »

So I've been a fan of cam11 for a long time but I've noticed something I've never bothered digging into. This line:

Code: Select all

cam:setZoom(0.6)
fails to draw lines - at all.

Any zoom works well but 0.6 (60%) precisely won't draw:

Code: Select all

love.graphics.line
love.graphics.circle("line")
love.graphics.rectangle("line")
but it will draw "fill" objects. It is odd and it is bizarre but is exactly zoom 0.60. See love file attached. This is repeatable on my Windows OS and on Gvovkiv Linux OS.

Run the love file with the console open, use the mouse wheel to change the zoom. Zoom to 0.60 and watch the magic.

Any clues?

Image

============

Image
Attachments
cam11_test.love
(6.59 KiB) Downloaded 27 times
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
User avatar
pgimeno
Party member
Posts: 3551
Joined: Sun Oct 18, 2015 2:58 pm

Re: Cam11 bug when zoom = 0.6 (specifically)

Post by pgimeno »

It's not a bug of cam11. Try this as main.lua:

Code: Select all

function love.draw()
    love.graphics.scale(0.6)

    love.graphics.circle("fill", 100, 200, 10)
    love.graphics.circle("line", 200, 200, 10)

    love.graphics.rectangle("fill", 300, 190, 20, 20)
    love.graphics.rectangle("line", 400, 190, 20, 20)

    love.graphics.line(100, 250, 410, 250)
end
Comment out the love.graphics.scale(0.6) to see the difference.

I don't know if this is fixed in Löve 12. Perhaps it's worth posting a bug report in the issue tracker if it annoys you.
User avatar
slime
Solid Snayke
Posts: 3133
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Cam11 bug when zoom = 0.6 (specifically)

Post by slime »

What do you expect a line with less than 1 pixel width that's not centered at the middle of pixels to look like in a pixel grid?

If you offset the line's position by (0.5, 0.5), then the centers of each end will be at the center of a pixel instead of in between 4 pixels.
User avatar
pgimeno
Party member
Posts: 3551
Joined: Sun Oct 18, 2015 2:58 pm

Re: Cam11 bug when zoom = 0.6 (specifically)

Post by pgimeno »

slime wrote: Mon Oct 23, 2023 6:44 pm What do you expect a line with less than 1 pixel width that's not centered at the middle of pixels to look like in a pixel grid?

If you offset the line's position by (0.5, 0.5), then the centers of each end will be at the center of a pixel instead of in between 4 pixels.
But what about the circle?
User avatar
slime
Solid Snayke
Posts: 3133
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Cam11 bug when zoom = 0.6 (specifically)

Post by slime »

pgimeno wrote: Tue Oct 24, 2023 12:06 pm But what about the circle?
It's using a line width that's smaller than 1, which is rarely going to give you a fully visible line.

The technical details for why it's entirely invisible have to do with the smooth line style's implementation reducing the core line width in order for the surrounding outer antialiasing line to not appear super thick. An implementation of line antialiasing that uses a completely different technique (like shader-based AA) might not have that behaviour. But regardless of which implementation is used, a line width that's less than 1 won't give you a fully visible fully opaque line because you've told it to be less than 1 pixel thick.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Amazon [Bot], Bing [Bot] and 72 guests