I'm currently trying to replicate this tutorial [http://gamedev.tutsplus.com/tutorials/implementation/simulate-fabric-and-ragdolls-with-simple-verlet-integration/] and I'm getting low FPS when I try to draw a grid.
I have 2500 points on screen, each spaced 6 pixels apart from each other, and I want to draw a line between each point and its neighbor. When I do so, my FPS goes from 4200 to 20-100. Is this normal, or am I doing something wrong?
Here's the code I'm using to draw the lines.
void SFML_Program::drawLine(sf::Vector2f a, sf::Vector2f b)
{
sf::Vertex line[2] = {a, b};
MainWindow.draw(line, 2, sf::Lines);
}
I've also tried:
void SFML_Program::drawLine(sf::Vector2f a, sf::Vector2f b)
{
sf::VertexArray lines(sf::Lines, 2);
lines[0].position = a;
lines[1].position = b;
MainWindow.draw(lines);
}
I'm calling that 4900 times to produce this.
http://i.imgur.com/tI1tz.pngThe code that calls it simply retrieves the two points it needs and then calls the drawline. Am I doing something wrong?