love2d / love

LÖVE is an awesome 2D game framework for Lua.
https://love2d.org
Other
5.06k stars 400 forks source link

love.graphics.setScissors() pixel bug #1915

Closed Fnoop1 closed 1 year ago

Fnoop1 commented 1 year ago

Knipsel Knipsel2 Data.zip

As you are able to see in the first image: when setting scissors cutoff point has the exact same coordinates as the rectange is wide and high, while drawing multiple rectanges you can see it doesn't cut off one of the rectangles properly since there is a slight gap between the 2 rectangles (bottom of the blue and pink one). These rectangles are objects, and drawn at 99% of the screen height (look in the zip in GUI/View/Test [Obj] to see where I made the 3 rectangle objects), and in GUI/Containers [Obj] for the logic behind the containers. This is most certainly a bug, since without the scissors funtion encapsulating the draw rectangle in the Containers obj file this problem does not occur (rounding the pixels down with math.floor doesn't help either).

I am on the most recent Windows 10 version with an Nvidea graphics card with up to date drivers, and running Love 11.4

slime73 commented 1 year ago

This is what the linked project looks like on my computer (Windows 10, with an nvidia 1070 GPU) - no pink/purple pixels at the bottom: image

slime73 commented 1 year ago

Also keep in mind scissors only operate on whole pixels, they aren't the same as rasterizing geometry to the framebuffer at subpixel precision. You can use stencils if you want that.

slime73 commented 1 year ago

I've updated the setScissor documentation a little bit to say something similar - fractional pixel values aren't something you should use with it.

Fnoop1 commented 1 year ago

Thanks for the quick response!, and the mention of stencil. With the correct use of math.floor or ceil this doesn't happen! The subpixels only show when the window is at certain heigts. Why math.round didn't work the first time is that even though the end point might be roundedm it is added up to the start point and the blue rectangle started at a subpixel... whoops...

Also while talking to a dev anyway :) How is the situation an LuaJIT? I saw the original guy abandoned it after disagreeing with some new Lua updates. So I wondered what will happen with the Love2D project after a few years when new chip architectures might come out. I don't quite understand how the complitation works, so that's my question. Love says it added support for Apple silicon in one of the latest updates, does that mean you can add your own support for new chips and architectures to keep the framework relevant? Or were you able to add Apples latest chip since it's ARM based? I want to know cause I REALLY like programming in Love, and hope to get an indication of how it's future will look.