cschreib / lxgui

Portable, real time, modular and data-driven GUI C++ library.
https://cschreib.github.io/lxgui
MIT License
72 stars 20 forks source link

Enable SFML implementation of `vertex_cache` #70

Open cschreib opened 3 years ago

cschreib commented 3 years ago

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.

cschreib commented 2 years ago

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.

cschreib commented 7 months ago

Upstream has merged the changes, they should be in SFML v3.0!