Scaling + Tiled Images = Gaps

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.
coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

Re: Scaling + Tiled Images = Gaps

Post by coffee »

Boolsheet wrote:
coffee wrote:In VirtualBox running Windows 8 (Fullscreen) the problem however don't occur.
Do you know if you have hardware acceleration enabled or does Windows 8 actually ship a new OpenGL fallback driver?
I did some more virtual testing since I was lazy before and I didn't test also W7 Virtual Box's machines. Funny thing is that XP SP3 running in same VirtualBox (fullscreen) have the gaps problem. Both machines had 2D and 3D acceleration on. This could well be some conjugation how Host+Client interpolates resolutions. I think gurok shouldn't worry too much about the output in virtualization modes but only in native modes since I think there is very few people that should use LOVE in virtual machines.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Scaling + Tiled Images = Gaps

Post by kikito »

gurok wrote:

Code: Select all

love.graphics.draw(image[i], math.floor(((i - 1) % width) * romance.texture.width) + x, math.floor(math.floor((i - 1) / width) * romance.texture.height) + y)
This is a totally blind shot, but it could be a matter of replacing map.floor with map.round. I'm guessing that in some occasions, depending on the floats and whatnot, doing math.floor could create some pixels.

The math library doesn't have a standard way of defining round, but a common way to implement it is:

Code: Select all

function math.round(x)
  return math.floor(x + 0.5)
end
If I remember correctly, this works with positive numbers only.

If all of this round/floor business fails, another option you can try is making your tiles 1 pixel bigger, and just let them overlap. I mean, Instead of splitting your image into two exact 512x512 quads, assume that it's divided into 510x510, but keep the quad size to 512x512. When drawing the quads, draw them "overlapping" one pixel on each direction. No matter which one comes on top, the result should be correct. This requires some operations with the coordinates, but it should not be very difficult, and you should not see any seams (it should even work with decimal coordinates).

I hope this makes sense.
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], pgimeno, Semrush [Bot] and 55 guests