SFML community forums

Help => Graphics => Topic started by: Futochu on March 18, 2015, 05:50:47 am

Title: [Solved] Why are my VertexArray graphics so much slower when zoomed in?
Post by: Futochu on March 18, 2015, 05:50:47 am
Hey all, I've recently been working on a map generator as an experiment with VertexArrays.  Originally I had been working with sprites, but at higher zoom levels I found that the rendering process was so resource intensive there was no way I could implement anything else.

As a result, I switched to VertexArray drawing which initially seemed to work quite well.  However, if I am to zoom in the rendering seems even slower than before (!?).  Unless I'm doing something wrong, this seems completely counter-intuitive to me.  Could someone point me in the right direction?

The code in question (The RenderArray work is in this branch). (https://github.com/Futochu/Townhou/tree/Switch-from-sprite-to-VertexArray)

The offending code is probably in Tilemap.cpp

Thanks.

EDIT: This was due to textures being loaded every draw cycle.  Higher zoom = larger images.  Who knew texture loading was so resource hungry?
Title: Re: Why are my VertexArray graphics so much slower when zoomed in? (Less vertices)
Post by: eXpl0it3r on March 18, 2015, 07:53:59 am
Use a profiler and find out what's the problem.
Title: Re: Why are my VertexArray graphics so much slower when zoomed in? (Less vertices)
Post by: Futochu on March 18, 2015, 08:05:39 am
Did not know these existed!  Thanks.

EDIT: Super easy to use to solve this issue.