SFML community forums
Help => Graphics => Topic started by: BaneTrapper on June 13, 2014, 04:20:37 pm
-
Hello.
I am wondering how to setup my sprites sheet for objects, tiles, and units...
Id personally put it in one big texture, but i was wondering If there are two draw calls with same texture, one after another, does it copy the texture again intro the gpu, or does it know not to copy texture again?
And if i wanted to find out something as this, would i read about GPUs, OpenGL or what?
-
The texture is already uploaded to the GPU when you create it. But if you make two draw calls with the same texture, you save one texture switch on the GPU, which is expensive.
-
EDIT:: I drawn conclusion you meant, there is no switch performed.
The texture is already uploaded to the GPU when you create it. But if you make two draw calls with the same texture, you save one texture switch on the GPU, which is expensive.
I am still unsure of the answer :D.
sf::Texture tex;
sf::RenderWindow & win;
sf::VertexArray verArr1;
sf::VertexArray verArr2;
sf::RenderStates renSta;
//Load texture
//... add vertices to both verArr
verArr1.setPrimitiveType(sf::Quads);
renSta.texture = &tex;
win.draw(verArr1, renSta);//Draw 1
win.draw(verArr2, renSta);//Draw 2
In draw 1, the texture switch will occur, its the first draw call i ever made.
My question is: Is the Draw 2, gonna perform a texture switch as well?
-
My question is: Is the Draw 2, gonna perform a texture switch as well?
No, it's not going to. (https://github.com/SFML/SFML/blob/master/src/SFML/Graphics/RenderTarget.cpp#L248-249)
-
My question is: Is the Draw 2, gonna perform a texture switch as well?
No, it's not going to. (https://github.com/SFML/SFML/blob/master/src/SFML/Graphics/RenderTarget.cpp#L248-249)
:D thx.