SFML render many sprites...

Started by
1 comment, last by MARS_999 9 years ago

I am new to SFML and was wondering if I use a renderlist and just want to render the whole list, how can I avoid call window.draw() 10 million times?

Is there some array call that one can send the whole list in one function call?

Thanks!

Oh and what is the correct way to setup a list to hold the many render types in SFML?

Is this correct?

std::list<sf::Drawble*> renderList;

Advertisement

No, a std::list of pointers is bad. Use sf::VertexArray or a std::vector<sf::Vertex>, fill it with all stuff needing the same texture and do a single draw.

http://www.sfml-dev.org/tutorials/2.2/graphics-vertex-array.php

Thanks wintertime!

This topic is closed to new replies.

Advertisement