Hi guys, i was reading the tutorials from SFML page, in the tutorial "Designing your own entities with vertex array" they explain that performance depend from number of calls of "draw" function. I created a class to draw batches of entities with different texture, this class inherit from "sf::Drawable" class and, in her method "virtual void draw (RenderTarget &target, RenderStates states) const;" i wrote the next code:
void Menu::draw (RenderTarget &target, RenderStates states) const
{
for (i = 0; i < quantityVertex; i++)
{
states.texture = &textures [i];
target.draw (vertexArray [i[, states);
}
}
this also can be done with the next code inside main game loop
for (i = 0; i < quantitySprites; i++)
window.draw (sprites [i]);
ok, my question is, which is more efficient??
thank so much for your answers
, i don't know english
Conclusion:
The performance of the function "draw" is given from the number of calls of the function "RenderTarget::draw (const Drawable &drawable, const RenderStates &states), that if someone serves you