[motherhamster] aligned tiles have gaps

Bob the Hamster Bob at HamsterRepublic.com
Thu May 10 13:57:22 PDT 2007


On Thu, May 10, 2007 at 01:52:32PM -0700, Brian Fisher wrote:
> On 5/10/07, Bob the Hamster <Bob at hamsterrepublic.com> wrote:
> > Check out the latest sidescroller code. Even though the 16x16 dirt tiles
> > are aligned neatly, gridlines show up between them. The width of the
> > gridlines varies depending on camera alignment.
> >
> > Even if I edit the display.render line in the DirtTile class in dirty.py
> > and add something like scale=1.05 to make the lines go away, they are
> > still visible when moving.
> >
> > I am thinking that this might have something to do with the fact that I
> > am using a floating point vector for camera position, but I am really
> > not sure what to do about it... Any ideas?
> >
> The polygons for the squares must be antialised. Floating point camera
> position shouldn't be a problem if they weren't. Given that they must
> be antialised, it must mean the dirt tiles are not fitting perfectly
> on pixel (integer) boundaries. You could try rounding every position
> before drawing. If that gets rid of the seams, then the openGL drawing
> stuff is good. If it doesn't, then the openGL drawing stuff is off.
> Also turning off antialising on the openGL guy should eliminate any
> gaps (but you may still have little edge popping if the camera moves
> subpixel)
> 
> I'm not sure what the best approach is really - Deciding to stick to
> perfect pixel boundaries is a proven technique. If you really want
> subpixel scrolling or scaling then the best thing for tiles is
> probably to overlap tiles somehow.

Do tiles automatically get antialiased? Because this is a 16x16 png with 
no transparency, and I am not scaling it at all.

I'll try making sure I round my coords before drawing. I don't really 
need sub-pixel accuracy on drawing, just on movement velocity and such.

---
James



More information about the Dev mailing list