This is very infamous bug/artifact, I kind of ran into it once, not sure if I fixed it or not or if it was appearing on certain machines only.
I tried that, and it works ok with a 2x2 tilesheet with 32x32 tiles(attached).
Changing bump in vert made line artifacts, but other two don't change a thing.
#include <SFML/Graphics.hpp>
sf::Vector2f vert(int x)
{
const sf::Vector2f bump(0.f,0.f);
switch(x)
{
case 1:return bump+sf::Vector2f();
case 2:return bump+sf::Vector2f(0.f,32.f);
case 3:return bump+sf::Vector2f(32.f,32.f);
case 4:return bump+sf::Vector2f(32.f,0.f);
}
}
sf::Vector2f texc(int x)
{
switch(x)
{
case 0:return sf::Vector2f();
case 1:return sf::Vector2f(32.f,0.f);
case 2:return sf::Vector2f(0.f,32.f);
case 3:return sf::Vector2f(32.f,32.f);
}
}
int main(int argc,char * argv[])
{
const sf::Vector2f bump(0.8f,0.3f);
const int mapx=5;
const int mapy=5;
const int map[mapx][mapy]=
{
{3,3,3,3,3},
{0,3,3,3,3},
{3,0,3,3,3},
{3,3,1,1,1},
{3,3,3,3,3},
};
sf::RenderWindow app(sf::VideoMode(640,480),"s");
app.setFramerateLimit(60);
sf::Texture tex;
tex.loadFromFile("img.png");
sf::VertexArray array;
array.setPrimitiveType(sf::Quads);
const float pos=64.f;
for(int x=0;x<mapx;++x) for(int y=0;y<mapy;++y)
{
const sf::Vector2f vec=texc(map[x][y]);
array.append(sf::Vertex(bump+sf::Vector2f(pos*x,pos*y),vert(1)+vec));
array.append(sf::Vertex(bump+sf::Vector2f(pos*x,pos*(y+1)),vert(2)+vec));
array.append(sf::Vertex(bump+sf::Vector2f(pos*(x+1),pos*(y+1)),vert(3)+vec));
array.append(sf::Vertex(bump+sf::Vector2f(pos*(x+1),pos*y),vert(4)+vec));
}
// tex.setSmooth(true);
while(true)
{
sf::Event eve;
while(app.pollEvent(eve));
const sf::Vector2f add(0.67325f,0.12354f);
sf::View v=app.getDefaultView();
v.setCenter(add+sf::Vector2f(sf::Mouse::getPosition(app)));
std::printf("%3.2f %3.2f\n",v.getCenter().x,v.getCenter().y);
app.setView(v);
app.clear();
app.draw(array,&tex);
app.display();
}
return 0;
}