0
\$\begingroup\$
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 800), "SFML works!");
sf::VertexArray Tquad(sf::Quads, 40*40*4);
int size{ 20 };
int width{ 40 };
for (int x = 0; x < width; x++)
{
    for (int y = 0; y < width; y++)
    {
        sf::Vertex* quad = &Tquad[(x + y * width) * 4];
        quad[0].position = sf::Vector2f(x, y);
        quad[1].position = sf::Vector2f((x+1)*size, y);
        quad[2].position = sf::Vector2f((x+1)*size, (y+1)*size);
        quad[3].position = sf::Vector2f(x, (y+1)*size);
    }
}

while (window.isOpen())
{
    sf::Event event;


    while (window.pollEvent(event))
    {
        if (event.type == sf::Event::Closed)
            window.close();
    }

    window.clear();
    window.draw(Tquad);
    window.display();
}

return 0;

}

Hello , im getting very low fps with only 40x40 tiles, in release mode i get 21 fps. If i disable the window.draw i get 2000+- fps.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

found the solution. quad[0].position = sf::Vector2f(x, y); quad[0].position = sf::Vector2f(xsize, ysize);* now fps is like 1100

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .