Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - ashleybeshir

Pages: [1]
1
Graphics / Vertex Array giving coluor to texture
« on: May 18, 2016, 04:39:27 am »
Hello ,

I know that you can add colour to the vertex but if i want to use a texture atlas . Is it possible to only change colour of it . Lets say i want to add green colour to brick instead of changing the texture itself in photoshop

Regards Ashley

2
Graphics / using vertexArray drops fps massively
« on: April 03, 2015, 01:37:40 pm »
Hello, ı was looking for a way to draw tile in game dynamically(edit or change at run time). I though of is i use vertexarray it can be done. Well it does the job excellently but fps drops very quick.
Commended vertex code (release ) = 2000+-
UnCommended vertex code (release) = 21+-1

There is massive difference in fps

int main()
{
        sf::RenderWindow window(sf::VideoMode(800, 800), "SFML works!");
        sf::CircleShape shape(100.f);
        shape.setFillColor(sf::Color::Green);
        sf::VertexArray quad(sf::Quads, 4);
       
        while (window.isOpen())
        {
                window.clear();
                sf::Event event;
                int size{ 20 };

                while (window.pollEvent(event))
                {
                        if (event.type == sf::Event::Closed)
                                window.close();
                }
                for (int x = 0; x < 40; x++)
                {
                        for (int y = 0; y < 40; y++)
                        {
                                quad[0].position = sf::Vector2f(x, y);
                                quad[1].position = sf::Vector2f(x*size, y);
                                quad[2].position = sf::Vector2f(x*size, y*size);
                                quad[3].position = sf::Vector2f(x, y*size);
                                window.draw(quad);
                        }
                }
               
                window.display();
        }

        return 0;
}

The code is pretty much the one from tutorial with the vertex just added. I know the for loops in combine call 40*40 time but i didnt expect it to fall this quick. Is there a alternative way to do it ?

Pages: [1]