Hi
After several weeks of work, I've finally commited the automatic batching code in the sfml2 branch.
Basically, it doesn't break anything in the public API so that most people won't notice anything except potentially improved performances.
The only modifications are on sf::Drawable and sf::RenderWindow:
- the Drawable::Render function now use a render queue instead of direct OpenGL calls
- drawables rendering nested drawables work better: the color is now combined in addition to transformations
- PreserveOpenGLStates doesn't exist anymore, states are now preserved by default (the rendering happens in one call, so doing it doesn't impact performances anymore)
- there's a new Flush function to manually trigger the actual rendering, for example if you need to draw 3D OpenGL on top of what SFML has drawn so far (otherwise rendering is automatically done in Display())
- RenderImage must now call Display() like RenderWindow
- windows are no longer active by default
- multithreading is potentially easier, as all the OpenGL calls happen in a single function (I haven't looked into that yet)
- rendering is now pixel perfect, all artifacts are gone (hopefully
)
Regarding the performances, I don't really know if it will really be faster on every computer (the code now uses a little more CPU), so I'll need as much feedback as possible
This is the first version, so I'll probably have to adjust/fix a few things.
On my computer, the worst case (drawing sprites with different states) gave the same performances as before, and the best case (all sprites use the same image and states) gave a 300% improvement. Shapes gave a 500% improvement. Strings are slightly slower to render, but it's much more consistent than before; and they will soon be rewritten so it doesn't really matters
The most important is that one can now draw intensive stuff like particle systems, tiles, GUI, etc. with SFML, there's no need to use OpenGL to get decent performances.
The next step will now be to rewrite PostFx to be compatible with the new system (and apply the modifications planned in the task list).
Please note that the quality of text rendering is slightly worse than before, it's a work in progress and it will be fixed soon.
CSFML and SFML.Net are also not up-to-date yet.