shaders are also great. too bad I'm not good at them :(
I want to render only what is viewed in the view, the first thing I need is to obtain the left top pixel of the current visualization, in order to get first tile that I want to draw. How can I obtain this pixel? I have been looking the View wiki and didn't found anything.
you can do something like this (i'm not getting the first pixel, but the first tile to be drawn). chunk_size is in tiles, not in pixels.
sf::Vector2i central_tile(std::floor(view.getCenter().x/tile_size.x), std::floor(view.getCenter().y/tile_size.y)); //central tile in the view
sf::Vector2i first_tile(central_tile.x-chunk_size.x/2, central_tile.y-chunk_size.y/2); //first tile, upper left
sf::Vector2i last_tile(first_tile + chunk_size); //last tile, bottom right
//[...]
for(size_t y=first_tile.y; y<last_tile.y; y++){
for(size_t x=first_tile.x; y<last_tile.x; x++){
//draw tile[x][y];
}
}