diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-03-21 19:43:05 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-03-21 19:43:05 +0400 |
commit | a8b6b5ec4c5c864fccda0e10990b65a784fd89e3 (patch) | |
tree | 7b2a73a10befe6368b7f3ed83cac0c040233aabd /source/blender/editors | |
parent | f3db38de56a123cf27fa8f7accb46b22027e6a82 (diff) |
use clip alpha setting for empty-image drawing.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index d447a4876b2..fa23139b382 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -603,10 +603,16 @@ static void draw_empty_image(Object *ob, const short dflag, const unsigned char glScalef(scale * sca_x, scale * sca_y, 1.0f); if (ibuf && ibuf->rect) { + const bool use_clip = (U.glalphaclip != 1.0f); /* Setup GL params */ glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + if (use_clip) { + glEnable(GL_ALPHA_TEST); + glAlphaFunc(GL_GREATER, U.glalphaclip); + } + /* Use the object color and alpha */ glColor4fv(ob->col); @@ -615,6 +621,11 @@ static void draw_empty_image(Object *ob, const short dflag, const unsigned char glPixelTransferf(GL_ALPHA_SCALE, 1.0f); glDisable(GL_BLEND); + + if (use_clip) { + glDisable(GL_ALPHA_TEST); + glAlphaFunc(GL_GREATER, 0.0f); + } } if ((dflag & DRAW_CONSTCOLOR) == 0) { |