voici un code minimal qui permet de constater tout ça :
il te faut deux ressources differente : BigTex ( la grande texture de 200x400 ) et SmallTex ( la texture de 50x50 ) , lorsque je charge BigTex j'observe une grosse baisse des fps, lorsque je charge SmallTex aucun souci de perf.
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#include "windows.h"
#include <SFML/Graphics.hpp>
#define OBJ_NUM 100
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
/*************************************************************/
//Startup console for debug purpose
......................................................
/*************************************************************/
// Create the main window
sf::RenderWindow window(sf::VideoMode(1280, 720, 32), "Avalanche", sf::Style::Close, sf::ContextSettings(32, 8, 16, 3, 3));
//Initialisation of app components
sf::Clock clock;
sf::Texture tex;
tex.loadFromFile("Data/BigTex.png");
tex.setSmooth( true );
sf::Sprite* sp[OBJ_NUM];
for( int i = 0; i < OBJ_NUM ; i++ )
{
sp[i] = new sf::Sprite( tex );
sp[i]->setPosition( rand() % 1280, rand() % 720 );
sp[i]->setTextureRect( sf::Rect<int>(0,0,30,50) );
}
float lastTime = 0;
float fps = 0;
// MainLoop
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
//Update Entities
float elapsed = clock.restart().asSeconds();
//ProcessDraw
window.clear( sf::Color(68,68,68) );
for( int i = 0; i < OBJ_NUM ; i++ )
{
window.draw( *sp[i] );
}
// Update the window
window.display();
lastTime += elapsed;
fps++;
if( lastTime >= 1.0 )
{
printf( "%3.5f \n",fps );
lastTime = 0;
fps = 0;
}
}
for( int i = 0; i < OBJ_NUM ; i++ )
{
delete sp[i];
}
return EXIT_SUCCESS;
}