16
DotNet / Bug with line drawing? Shouldn't it go from p1 to p2? (easy)
« on: February 01, 2009, 07:22:20 pm »Quote from: "sofakng"
Darn floats. They always cause problems!
The reason I found this bug was because I'm trying to draw isometric tiles using the SFML drawing functions but the sides of the tile do not line-up correctly. I guess it's a little confusing because OpenGL and Flash both seem to render the lines "correctly" (but I suppose correct is a relative term).
I might be able to use pre-generated sprites so my lines are always correct but I was hoping to use the drawing functions for other purposes as well.
You should always be allowing a pixel or so of overlap in your displays to prevent these "texture seams." Remember OpenGL or any 3D API correctly uses floats, so you have to expect and prepare for rounding variance.
You can possibly ignore this if everything you draw is axis-aligned and you always force it to the int value you want (with checks to make sure it rounds the correct way), but this will never be the case with "isometric" tiles. Either way, just having all your terrain textures (or any textures that are supposed to touch and match up) overlap by 1 pixel will fix all these issues.