1
General / Re: Optimize this City Map application?
« on: May 18, 2018, 10:41:32 pm »Why does your average slowly count up? And what exactly does the value mean?
Help section is the right place, as you're asking for help and not discuss something in general.
It's because I calculate the average based on the last 500 records, so it takes a while for it to stabilize the average when I suddenly add more polygons to the screen. Everytime my draw everything function is called, it records the time it took and updates the average.
Anyway. I should probably mention I was doing something really stupid: rather than putting every triangle in one sf::VertexArray, had one sf::VertexArray for every polygon. When I changed this, so I only have to do one draw(...) call, I had a huge performance gain.
How many triangles do you have in total? It looks like you need a lot, to define areas with so many details. What about pre-rendering all that stuff and drawing it with textured quads? It's just an idea though, I don't know if it will give better results. If you want to know for sure what should be improved, use an OpenGL profiler and check what the bottleneck is.
The dream is to display every block, which in total is close to 1.000.000 triangles. But even with the optimization cited above, it's too much for my machine, which takes 80ms in average to do so.
Now I'm trying to do something smarter, which is the way you usually see being done with interactive maps: I'll break it into layers and tiles and only draw a tile if the camera is zoomed in enough and it is within the view boundaries.
I would also pre render your city, as it does not seem to change?
I don't want to prerender if I can avoid it because I want it to experiment doing some cool stuff with the polygons.
Wish me luck!