From 100313db6ecec36ad0c8e5b8a8d11bd170ff9349 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 17 Sep 2011 10:45:20 +0000 Subject: Speedup for font drawing, every letter was character was calling: glGetIntegerv(GL_TEXTURE_2D_BINDING_EXT, &cur_tex); ... with shadow enabled glGetFloatv(GL_CURRENT_COLOR, color) was called twice per character as well. Now only call glGetFloatv(GL_CURRENT_COLOR, ...) once per string and only when drawing with shadow or blur, texture bind is stored in the font. Gives 8% overall FPS speedup when displaying heavy UI in my test. --- source/blender/blenfont/intern/blf_internal_types.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source/blender/blenfont/intern/blf_internal_types.h') diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h index 9840e6446ef..1450ad39ad8 100644 --- a/source/blender/blenfont/intern/blf_internal_types.h +++ b/source/blender/blenfont/intern/blf_internal_types.h @@ -161,7 +161,10 @@ typedef struct FontBLF { /* shadow color. */ float shadow_col[4]; - + + /* store color here when drawing shadow or blur. */ + float orig_col[4]; + /* Multiplied this matrix with the current one before * draw the text! see blf_draw__start. */ @@ -179,6 +182,9 @@ typedef struct FontBLF { /* max texture size. */ int max_tex_size; + /* current opengl texture bind, avoids calling glGet */ + int tex_bind_state; + /* font options. */ int flags; -- cgit v1.2.3