Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-03-30 21:59:45 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-03-30 21:59:45 +0300
commit963e48e1dfb09520369b9a3a31b4f57663651c21 (patch)
tree52644c734ae20c4a011da3bc146bd438b8a9a56f /source/blender/blenfont/intern/blf.c
parentfb1463ff2bc707b00223c913c6a9e4f35ba94fd4 (diff)
BLF: Add Batching capabilities.
You can now use BLF_batching_start and BLF_batching_end to batch every drawcall to BLF together minimizing the overhead introduced by BLF and the opengl driver. These calls cannot be nested (for now). If the modelview matrix changes, previously batched calls are issued and a the process resume with the new matrix. However the projection matrix MUST not change and gl scissors as well.
Diffstat (limited to 'source/blender/blenfont/intern/blf.c')
-rw-r--r--source/blender/blenfont/intern/blf.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index 5b51ecbc047..2407abdaf28 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -540,6 +540,19 @@ void BLF_color3f(int fontid, float r, float g, float b)
BLF_color4fv(fontid, rgba);
}
+void BLF_batching_start(void)
+{
+ BLI_assert(g_batch.enabled == false);
+ g_batch.enabled = true;
+}
+
+void BLF_batching_end(void)
+{
+ BLI_assert(g_batch.enabled == true);
+ blf_batching_draw(); /* Draw remaining glyphs */
+ g_batch.enabled = false;
+}
+
void BLF_draw_default(float x, float y, float z, const char *str, size_t len)
{
ASSERT_DEFAULT_SET;