1
Graphics / Best way to render, performance-wise
« on: September 25, 2013, 10:28:01 am »
Hello again SFML community!
I am currently developing a game project, and it has come to my attention that the performance is quite lacking, at least for me and some of my testers.
One of my biggest concerns is the rendering method I use. Performance-wise, what is the most efficient way of rendering sprites to the window?
Currently I am using a RenderWindow and its draw() function to draw sprites on it, then use display() at the end of every loop. Some post on the internet suggested using a RenderTexture first, however, and only extracting it to a Texture and drawing it to the Window in the end of the loop.
1. So which one of these are better, and if neither of them are, is there a faster way to render sprites?
2. Will maintaining a "background" RenderTexture (a texture that won't change and can be reused over and over again) give significant improvement than rendering ~100 sprites to the RenderWindow per loop?
3. Which process is actually the most expensive one anyway? The draw(), or the display() function?
4. On an unrelated (window-related) note, what does setVerticalSyncEnabled() do? Can it be used together with setFrameRateLimit()?
For reference, the target FPS is about 30. There are occasionally some lag during gameplay on my laptop, but considering how it can run skyrim pretty fine (at low specs though), I kinda doubt the code logic is the source of the problem. Or can you actually 'request' more performance priority from the machine?
Thanks!
I am currently developing a game project, and it has come to my attention that the performance is quite lacking, at least for me and some of my testers.
One of my biggest concerns is the rendering method I use. Performance-wise, what is the most efficient way of rendering sprites to the window?
Currently I am using a RenderWindow and its draw() function to draw sprites on it, then use display() at the end of every loop. Some post on the internet suggested using a RenderTexture first, however, and only extracting it to a Texture and drawing it to the Window in the end of the loop.
1. So which one of these are better, and if neither of them are, is there a faster way to render sprites?
2. Will maintaining a "background" RenderTexture (a texture that won't change and can be reused over and over again) give significant improvement than rendering ~100 sprites to the RenderWindow per loop?
3. Which process is actually the most expensive one anyway? The draw(), or the display() function?
4. On an unrelated (window-related) note, what does setVerticalSyncEnabled() do? Can it be used together with setFrameRateLimit()?
For reference, the target FPS is about 30. There are occasionally some lag during gameplay on my laptop, but considering how it can run skyrim pretty fine (at low specs though), I kinda doubt the code logic is the source of the problem. Or can you actually 'request' more performance priority from the machine?
Thanks!