Hello, I have a strange problem with a simple test program. I try to display a number of rectangles, but I noticed that a number less than 279 works well, 279 or more freeze.
#include <SFML/Graphics.hpp>
void drawrect(int x, int y, int size, sf::RenderTarget& target)
{
sf::RectangleShape rectangle;
rectangle.setSize(sf::Vector2f(size, size));
rectangle.setOutlineColor(sf::Color::White);
rectangle.setOutlineThickness(1);
rectangle.setFillColor(sf::Color(0,0,0,0));
rectangle.setPosition(x, y);
target.draw(rectangle);
}
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "TEST");
window.setMouseCursorVisible(true);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
// draw
window.clear();
for (int i=0;i<279;i++)
drawrect(i, i, 1, window);
window.display();
}
return 0;
}
What's the problem here?
Thanks