diff options
author | Mike Erwin <significant.bit@gmail.com> | 2016-09-17 14:33:02 +0300 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2016-09-17 14:33:48 +0300 |
commit | 1b1275f0db85101345def817fee486beebaa6b9a (patch) | |
tree | 1c6338f84ca852f587e213cea609a3f026984886 /source/blender/blenfont/intern | |
parent | c3034afa586e3c5009f852e42c6a46000daa2551 (diff) |
add GPU_SHADER_TEXT for font rendering
With USE_GLSL enabled, GPU_basic_shader(TEXTURE|COLOR) always rendered black. New shader uses a solid color + alpha channel of texture (which in our case is a font glyph). See fragment shader for details.
I prefer this approah -- multiple shaders that each do one thing well (and are easy to read/write/understand), instead of one shader that can do many things given the right options.
Diffstat (limited to 'source/blender/blenfont/intern')
-rw-r--r-- | source/blender/blenfont/intern/blf.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 132a0ec3808..ec1f3d1f1f1 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -56,7 +56,7 @@ #include "IMB_colormanagement.h" #ifndef BLF_STANDALONE -#include "GPU_basic_shader.h" +#include "GPU_shader.h" #endif #include "blf_internal_types.h" @@ -501,7 +501,7 @@ static void blf_draw_gl__start(FontBLF *font, GLint *mode) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); #ifndef BLF_STANDALONE - GPU_basic_shader_bind(GPU_SHADER_TEXTURE_2D | GPU_SHADER_USE_COLOR); + GPU_shader_bind(GPU_shader_get_builtin_shader(GPU_SHADER_TEXT)); #endif /* Save the current matrix mode. */ @@ -544,8 +544,9 @@ static void blf_draw_gl__end(GLint mode) glMatrixMode(mode); #ifndef BLF_STANDALONE - GPU_basic_shader_bind(GPU_SHADER_USE_COLOR); + GPU_shader_unbind(); #endif + glDisable(GL_BLEND); } |