lxgui
lxgui copied to clipboard
Enable SFML implementation of `vertex_cache`
SFML has an implementation for vertex_cache
, but this is currently disabled because the implementation is not working correctly. The reason is that SFML requires texture coordinates in pixels, while lxgui uses normalised coordinates throughout. The conversion was handled on-the-fly for simple quads, but this isn't possible with vertex_cache
(it would ruin all the benefits of using a cache in the first place).
I have submitted a PR to SFML to add support for normalised coordinates, which was partly available but not fully exposed to the user: https://github.com/SFML/SFML/pull/1807. In lxgui, the branch https://github.com/cschreib/lxgui/tree/vertex_cache_sfml makes use of this patched SFML to enable vertex_cache
in the SFML implementation, which then works perfectly fine and improves performance of text rendering.
If the PR is merged, or if using a custom build of SFML, the SFML implementation of vertex_cache
can now be turned on by defining the macro SFML_HAS_NORMALISED_COORDINATES_VBO
when building lxgui.
Upstream has merged the changes, they should be in SFML v3.0!