Here's what eduard engine does to get rid of lines between vertex arrays(but it
will cause half pixel diffrences between vertexs arrays and objects that get drawn without pixel perfection and it's a chety workaround):
In render proc:
1. Set center of member view variable to center of player,
2. pass view to setppview method
3. tell map to prepare all vertex array that fall into view for drawing
4. draw map
5. set window's view to the member view varialbe
6. draw anything that didn't require pixel perfection
7. draw debugging data (irrelevant here)
In setppview :
Round so that left top corner of view has integer coords and set that view
void EEGameScreen::Render(void)
{
the_view.setCenter(Rptr->GetSMiddle());
SetPPView(the_view);
my_map.SetView(the_view);//wrong but ok 4 now,
EE::Sys().Renderer.draw(my_map);
EE::Sys().Renderer.setView(the_view);
EE::Sys().Renderer.draw(*Rptr);
if (draw_debugs){game_world->DrawDebugData();}
}
void EEGameScreen::SetPPView(const sf::View& gview)
{
sf::View copy=gview;
sf::Vector2f halfsize=(copy.getSize()/2.f);
sf::Vector2f vec=(copy.getCenter()-halfsize);
vec.x=EESignedRound(vec.x);
vec.y=EESignedRound(vec.y);
copy.setCenter(vec+halfsize);
EE::Sys().Renderer.setView(copy);
}
inline float EESignedRound(float a)//rounds float to nearest integer and returns it as float, respects the sign
{
return (a>=0)?static_cast<float>(static_cast<int>(a+0.5f)):static_cast<float>(static_cast<int>(a-0.5f));
}
Of course replace EE::Sys().Renderer with your render window.
You can download exe from my thread in sfml projects if you want to see a demonstration.