diff options
author | Ray Molenkamp <github@lazydodo.com> | 2018-06-22 03:35:37 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2018-06-22 03:36:05 +0300 |
commit | 84ae0fe3a5f5707a5ff658292fefcfc5f9cf04b8 (patch) | |
tree | 1a1ac643881b2b8c0fc891589cf3f7ef057f6015 /source/blender/blenfont/intern/blf_font.c | |
parent | 4f83fd4cf8b69497beddc498033a7a2beea24d80 (diff) |
GLRefactor: Refactor bf_blenfont to use GPUTexture instead of raw GL calls and types.
In an effort to centralize all opengl calls in the codebase, this patch replaces
the raw opengl calls in bf_blenfont with GPUTexture so it's no longer depended
on opengl headers.
reviewer: Brecht
Differential Revision: https://developer.blender.org/D3483
Diffstat (limited to 'source/blender/blenfont/intern/blf_font.c')
-rw-r--r-- | source/blender/blenfont/intern/blf_font.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 1289dc6c5a6..13c857b0d4b 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -183,16 +183,13 @@ void blf_batch_draw(void) if (g_batch.glyph_len == 0) return; - glEnable(GL_BLEND); - glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + GPU_blend(true); + GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); /* We need to flush widget base first to ensure correct ordering. */ UI_widgetbase_draw_cache_flush(); - BLI_assert(g_batch.tex_bind_state != 0); /* must still be valid */ - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, g_batch.tex_bind_state); - + GPU_texture_bind(g_batch.tex_bind_state, 0); GWN_vertbuf_vertex_count_set(g_batch.verts, g_batch.glyph_len); GWN_vertbuf_use(g_batch.verts); /* send data */ @@ -201,7 +198,7 @@ void blf_batch_draw(void) GWN_batch_uniform_1i(g_batch.batch, "glyph", 0); GWN_batch_draw(g_batch.batch); - glDisable(GL_BLEND); + GPU_blend(false); /* restart to 1st vertex data pointers */ GWN_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.pos_loc, &g_batch.pos_step); |